Install MySQL5 Server on Apple Mac Leopard with MacPorts

Previously I wrote a post on “installing postgresql 8.2 on Leopard with macports“, seem like quite a no. of people also interested to know how to MySQL5 as server on Mac Leopard with MacPorts.

As usual, it’s advice to update your port before installing any latest software from Macports. To update your Macports;



sudo port -v selfupdate

To configure MySQL5 as server on your Mac Leopard, here are the steps.



sudo port -v install mysql5 +server

After installation, you have to run this command to installd default database;



sudo -u mysql mysql_install_db5

To start MySQL5, run this command;



sudo /opt/local/etc/LaunchDaemons/org.macports.mysql5/mysql5.wrapper start

After you have started MySQL, change your MySQL’s root default password;



mysqladmin5 -u root password 

If you would like to start MySQL when machine boot up, add the start up script into launchctl. To learn more about launchctl, type



man launchctl

Enjoy MySQL!