Install MySQL on Mac OS X 10.7+
The no fuss, no muss guide to installing the latest stable version of MySQL DB locally on your Mac running OS X 10.7 or later. (Hat tip to Trey Piepmeier for his excellent tutorial, upon which I improved a few things.)
Install MySQL (using Homebrew)
I’ll assume you’ve already installed Homebrew.
Assuming you have your brew
command ready to rock, make sure to run a quick brew update
, telling brew to fetch the latest packages:
OK? Good. Now you need to tell brew to install MySQL by entering this command:
Enter the following two commands, one after the other (the second one starts up your new, local MySQL server and creates an initial database):
Launch MySQL Automatically
The output from that last command should instruct you to enter three additional commands. (The ones below might not be exactly what you see in your terminal. Of course, make sure you follow those instructions and not these below, unless they’re identical.):
The three commands above do the following, respectively: create a LaunchAgents folder for you if you don’t already have one, copy the mysql.plist file into that launch folder, and then loads that file into a system file so that Mac OS X starts MySQL for you each time you restart your machine. Perfect!
Start Configuring MySQL
One final (optional) step is to run the included MySQL root/user config script. It’ll step you through various default username/password/etc options that you might want to configure now that you’ve got MySQL up and running on your machine. To run this automated post-MySQL-install wizard, enter:
Or, perhaps you’re interested in Installing and Setting up PostgreSQL on Mac OS X?