MySQL doesn’t come installed on Macs, so if you’re looking for a quick guide on how to set it up on your Mac, here are some simple instructions:

1) Go here and download the DMG or TAR version. (i used DMG):
http://dev.mysql.com/downloads/mysql/5.1.html#macosx-dmg

2) You have to sign up for an oracle account in order to download. It takes two minutes.

3) After downloading the archive, open up the MySQLStartupItem.pkg file.

4) If your Mac settings prevent you from opening the file because the developer is unrecognized, you may see this error message:

“MySQLStartupItem.pkg” can’t be opened because it is from an unidentified developer.

If this happens, simply override it by ctrl+clicking the MySQLStartupItem.pkg and selecting ‘open’. You will then be given the option of opening the file and overriding your security options

5) After you have installed the Startup Item, use this command in your terminal:

bash> sudo /Library/StartupItems/MySQLCOM/MySQLCOM start
(ENTER YOUR PASSWORD, IF NECESSARY)
(PRESS CTRL+D OR ENTER "EXIT" TO EXIT THE SHELL)

6) You should now be able to connect to the MySQL server, for example, by running /usr/local/mysql/bin/mysql

7) You might want to add aliases to your shell’s resource file to make it
easier to access commonly used programs such as "mysql" and
"mysqladmin" from the command line. The syntax for bash is:

alias mysql=/usr/local/mysql/bin/mysql
alias mysqladmin=/usr/local/mysql/bin/mysqladmin

8) Voila! Simply type mysql into your terminal to run.

comments powered by Disqus