Installing MySQL on Mac OS X El Capitan 10.11

As it has been for while, OS X no longer includes MySQL. In this article we take a quick look at how to install MySQL and then how to run the Secure Installation to change the default root password.

Download the latest version of MySQL available from the official web site. At time of writing this was 5.7.9 and the description didn’t say it was for 10.11 – but it works fine. Choose the DMG package for easiest installation. You don’t have to sign up to the web site, just click “No thanks, just start my download” beneath the sign up box.

Screen Shot 2015-10-22 at 14.28.51

Once downloaded, run the installer. At the end of the installer you will be presented with a dialog of the automatically created root password. Take a note of this.

Screen Shot 2015-10-22 at 14.33.06

Open up System Preferences, and select the new MySQL icon.

From here you can start and stop the service, and you can set it to start automatically on startup. Go ahead and start the service.Screen Shot 2015-10-22 at 14.36.23

MySQL is installed in to:

/usr/local/mysql/

Open up a Terminal window and change to the MySQL folder:

cd /usr/local/mysql/bin/

Run the MySQL Secure Installation and enter the password you were given earlier (please note, that it may first prompt you for your system password):

sudo ./mysql_secure_installation

It will warn you that the root password has expired. This is your opportunity to set your own. Enter it twice.

Follow through the remaining questions answering yes or no, depending on your environment. You can then manage your MySQL databases in your preferred method. I like to use Sequel Pro.

All done!

 

Print Friendly
  • Timur

    I followed your steps and it says “(Access denied for user ‘root’@’localhost’ (using password: YES))”, when I try to run my project.

    • http://www.mactasia.co.uk/ Simon

      Hi Timur, I think you need to run the secure installation again. Make sure you set the root password. That error usually means the wrong password.

  • David

    Just wanted to say thanks for this, Simon! I’d been stuck with the message that the root password had expired and I needed to change it, but there were no clear instructions on how to do this– eventually I reinstalled MySQL and followed the steps you’ve outlined above– worked like a charm! Thanks again.

  • trickbox

    I entered the command sudo ./mysql_secure_installation but it returns command not found. Mysql is installed and running so I’m confused.

    • http://www.mactasia.co.uk/ Simon

      Have you “cd” to the correct directory? If you go to the folder in finder, is the MySQL installation in there?

      • trickbox

        ThanksI got it to work after uninstalling and reinstalling MySQL, now I just have to get the Preference Pane to work.