Instructions for installing MySQL and some helpers.
Download MySQL Community Server: http://dev.mysql.com/downloads/mysql/
At the time of writing, I chose Mac OS X 10.7 (x86, 64-bit), DMG Archive and there’s no need to register just click ‘No thanks, just start my download.’
After download, open the DMG then read the ReadMe.txt before running the installer. There are some considerations regarding existing installations as well as useful info about starting MySQL automatically and paths.
Assuming this is a fresh install, double click the pkg file, in my case mysql-5.6.19-osx10.7-x86_64.pkg, to start the installer.
Once finished, if you want MySQL to start automatically double click MySQLStartupItem.pkg and let it perform it’s magic.
Secondary/right click MySQL.prefPane and open in System Preferences. This will allow control of MySQL from the GUI.
From the ReadMe.txt:
After the installation, you can start up MySQL by running the following commands in a terminal window. You must have administrator privileges to perform this task. If you have installed the Startup Item, use this command: shell> sudo /Library/StartupItems/MySQLCOM/MySQLCOM start (ENTER YOUR PASSWORD, IF NECESSARY) (PRESS CONTROL-D OR ENTER "EXIT" TO EXIT THE SHELL) If you don't use the Startup Item, enter the following command sequence: shell> cd /usr/local/mysql shell> sudo ./bin/mysqld_safe (ENTER YOUR PASSWORD, IF NECESSARY) (PRESS CONTROL-Z) shell> bg (PRESS CONTROL-D OR ENTER "EXIT" TO EXIT THE SHELL) You should be able to connect to the MySQL server, for example, by running `/usr/local/mysql/bin/mysql'.
Add MySQL bin path to PATH:
I prefer to add the path rather than add aliases for each bin, open Terminal:
Add these lines, save and quit:
# MySQL export PATH=$PATH:/usr/local/mysql/bin
New Terminal sessions will see the change automatically as the .profile script is run on launch; to apply this change to the current Terminal:
Harden the MySQL Installation
To remove anonymous users, remote root access etc:
Create a MySQL super user: here
Seems the stock installer script does not work without some modification on OSX: Resolution info found here: http://soarhevn.blogspot.co.uk/2011/09/using-automysqlbackup-on-os-x-lion.html
Start & Stop MySQL
Use the System Preferences pane or if using the startup item:
sudo /Library/StartupItems/MySQLCOM/MySQLCOM start
sudo /Library/StartupItems/MySQLCOM/MySQLCOM stop
sudo /Library/StartupItems/MySQLCOM/MySQLCOM restart
If not using the startup item:
shutdown with mysqladmin:
mysqladmin shutdown -u root -p
startup as detailed above.
Alternative installer script
Have not tried this but looks good: http://www.macminivault.com/mysql-mavericks/