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:
darwin_8
server

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’