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’
Related posts:
- Install MySQL5 Server on Apple Mac Leopard with MacPorts Previously I wrote a post on “installing postgresql 8.2 on...
- MySQL Cannot Connect with PHP in OSX I think some of you might have problem connecting to...
- postgresql82-server compile error on Apple Leopard with Macports 1.5 I wasn’t able to compile postgresql82-server on my machine, it’s...
- MySQL 5 Server Cannot Start on Apple Mac Leopard There were some problem during configuring MySQL5 Server on Leopard...
- OS X Lion Macports OS X Lion Macports, Can I upgrade from Snow Leopard?...
- Problem Upgrade Apache2 on MacPorts I was trying to upgrade apache2 on my Macports but...
- MySQL Quick Installation on FreeBSD Quick installation of MySQL Database on FreeBSD Server. Make sure...
- How do I Start Application Services with launchctl When Apple Mac Leopard Boot Up If you have MySQL, PostgreSQL, Apache2 or other application installed...
- installing postgresql 8.2 on Leopard with macports postgresql! one of my favorite high performance open source db,...
- Reset MySQL Root Password Very often, once we didn’t log on to MySQL database...

March 30th, 2007 at 5:13 am
Hey -
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!
June 5th, 2007 at 9:35 pm
[...] to Paul Ooi for this simple installation [...]