Installing MySQL in macOS Sierra

Installing and using MySQL in Mac OS X is a little different than the other Unix OS. In this article, I will list the basic steps.

Download and Install

First, download the DMG archive for Mac OS X from

Double click the DMG archive to mount it. Double click the pkg file for MySQL. This will launch the installer GUI. Complete the installation.


The installer will assign a random password for root. Copy the password.

Starting the Server

Start the server by running this command:

sudo /usr/local/mysql/support-files/mysql.server start

You can stop the server as follows:

sudo /usr/local/mysql/support-files/mysql.server stop

Starting the Client Tool

Make sure that the server is running. Run this command to launch the client tool:

/usr/local/mysql/bin/mysql -u root -p

This will connect to the server using the user id root. Here root is a MySQL user and not the OS user. Enter the password generated by the installer.

Change Root Password

While connected to MySQL using the mysql client tool, enter this SQL statement:

ALTER USER 'root'@'localhost' IDENTIFIED BY 'my_password';

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.