Install MySql5 on Snow Leopard using MacPorts
Install MacPorts before you do anything.
Install MySQL5
sudo port install mysql5 sudo port install mysql5-server sudo -u mysql mysql_install_db5
Secure MySQL5
To secure your MySQL5 installation, you can either change the password manually like so:
/opt/local/lib/mysql5/bin/mysqladmin -u root password {new-password}
or on a production system, you can run the secure script and not only change the password, but remove anonymous access and prevent remote root login.
/opt/local/lib/mysql5/bin/mysql_secure_installation
To start the MySQL daemon, type:
sudo /opt/local/lib/mysql5/bin/mysqld_safe &
or to make sure MySQL5 is launched at startup every time:
sudo launchctl load -w /Library/LaunchDaemons/org.macports.mysql5.plist
sudo launchctl load -w /Library/LaunchDaemons/org.macports.mysql5.plist
Create a symbolic link
sudo ln -s /opt/local/bin/mysql5 /opt/local/bin/mysql
Test the installation
mysql -u root -p
It should prompt you for a password and you should see the “mysql>” prompt