App overview screenshotSQL and Database Guides
PostgresMySQL
Try our free SQL Client
Tools
Connecting to MySQL
Connecting to drivers
Installing MySQL
Setting up MySQL
MySQL   >   
Installing MySQL   >   
MySQL on Mac

Install MySQL on MacOS or OS X

Download MySQL

The Oracle MySQL Community website is the best place to download the MySQL installer for Mac. Select previous versions of MySQL and check the OS version in the DMG download.

choose-mysql-version.png

Follow the Prompts

Click through each prompt from the installer. Important it will ask you for a password for the root user of the database. You must note this password down in order to make the initial connection.

Connect as the Root User

At this point, the MySQL 8 server should be running locally on your machine. It will only be running if you left the box checked to do so during Configuration in the Installer. Now, let's connect to it!

arctype connect to database

This is a screenshot from Arctype but you can use any SQL client to connect to your local MySQL database. Key items:

  • The name of the database is 'mysql'
  • The user is 'root'
  • The password is the password you set during the install

Setup Security for your New MySQL Database

Now that you have connected, you should make a few changes to improve the security of your database. The first is to create a new database that is separate from the mysql informational database you are currently connected to.

CREATE DATABASE mynewdatabase

Next you should create a new user.

CREATE USER 'me'@'localhost' IDENTIFIED BY 'mypassword'

Lastly you will need to grant this user full permissions on the database you just created.

GRANT ALL PRIVILEGES ON mynewdatabase. * TO 'me'@'localhost'

Apply these permissions:

FLUSH PRIVILEGES

Switch to the New User and Database

Good job! A new user and database has been created. Go back to the settings menu in your SQL client and switch to this user and database. You're ready to start writing queries!

Want to ask for help on databases or SQL? Join our Discord community.