Install MySQL5 on Mac OSX With Darwin Port
Before installing MySQL5, please be sure you have Darwin Port installed on your OS X. If yes, let’s start to roll now… Fire up your terminal and type
port variants mysql5
You will see variants support for mysql5 installation.
mysql5 has the variants:
Next, is the time to start install MySQL5 with Darwin Port.
sudo port -v install mysql5 +server
After MySQL is installed, is time to configure and make MySQL start and running. First you have to init mysql data db with this command
sudo /opt/local/lib/mysql5/bin/mysql_install_db –user=mysql
Before starting mysql, copy my.cnf file to /opt/local/etc folder
cp /opt/local/share/mysql5/mysql/my-small.cnf /opt/local/etc/my.cnf
To start mysql,
sudo /opt/local/share/mysql5/mysql/mysql.server start
mysql.server is default start up script. You can copy it to /bin for your convenient to start/stop MySQL daemon anytime. For the first time, please make your MySQL username: root with password by this command.
mysqladmin5 -uroot password ‘your-passwd-here’
Thanks for the blog posting – I was having issues with trying to find *where* the default my.cnf was located in the mac ports distribution of MySQL. The ‘mysql.server’ start/stop script location was good to know as well!
That said, I’d like to point out that the actual copying of my.cnf should target ‘/opt/local/etc/mysql5/’, not ‘/opt/local/etc/’.
I also ran into a later issue starting up the actual mysqld_safe5 process.
If you see this error in your mysql error log (usually located in /opt/local/var/db/mysql5/.local.err)
070311 18:30:58 [ERROR] Can’t start server : Bind on unix socket: Permission denied
070311 18:30:58 [ERROR] Do you already have another mysqld server running on socket: /opt/local/var/run/mysql5/mysqld.sock ?
check the ownership on /opt/local/var/run/mysql5 and make sure the owner/group combination is ‘mysql/mysql’. If it isn’t, use ‘sudo chown -R mysql:mysql /opt/local/var/run/mysql5’ to set the ownership properly.
Again – thanks for the helpful post!
[…] to Paul Ooi for this simple installation […]