Installing MySQL in Mac OS X El Capitan

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 For example, the downloaded file will be mysql-5.7.9-osx10.10-x86_64.dmg.

Double click the DMG archive to mount it.

Double click the pkg file for MySQL, for example mysql-5.7.9-osx10.10-x86_64.pkg. 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 launchctl start com.mysql.mysql

You can stop the server as follows:

sudo launchctl stop com.mysql.mysql

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 )

Twitter picture

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

Facebook photo

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

Google+ photo

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

Connecting to %s