UPDATE: This post is probably very out of date. Please use at your own risk.

mysqlRecently, while doing some development on my Mac, I realized I didn’t have MySQL installed. I could have loaded up an instance of Ubuntu 12.04 LTS on VirtualBox and used that. However, I thought it would be much more convenient to have it available directly instead in a virtualized environment. Here are the instructions for installing it on a Mac using Homebrew.

This guide assumes Homebrew is installed and properly functioning.

 

First, ensure that Homebrew is update to date and ready to brew:

Next, install MySQL:

Start MySQL:

 

Secure your MySQL installation. The main purpose of doing this is to ensure that the configuration of the local environment is set up as close as possible to the production environment.

Run the following two commands to allow MySQL to run under your user account:

Add the following my.cnf file to /etc:

Restart the MySQL server: