Friday, December 12, 2008

Installing MySQL on OS X

It's actually not required to get started on Django, but I thought it would be a good idea to jump through the MySQL hoops early.

It was a bit of an adventure:

The MySql install instructions are broken for OS X. After you have
downloaded the MySql package and installed it with the usual dance,
you will probably encounter some instructions involving

Various mortals seem to have gotten confused by this and
run into various smug bastards being unhelpful. Ignore the smug bastards.


Instead, follow the instructions at

However, the lines


$ cd /Library/LaunchDaemons
$ sudo chown root com.mysql.mysqld
$ sudo chgrp wheel com.mysql.mysqld
$ sudo chmod 644 com.mysql.mysqld


should read:


$ cd /Library/LaunchDaemons
$ sudo chown root com.mysql.mysqld.plist
$ sudo chgrp wheel com.mysql.mysqld.plist
$ sudo chmod 644 com.mysql.mysqld.plist


Otherwise the instructions are OK.

Now it tells me to check with ... What is that?

Wahoo! There it is in Utilities. I run it and it claims mysqld is running and
ready for connections.


So now to find mysql; open a Terminal window.

OK, now mysql isn't in my path yet, but I can invoke a mysql session



/Guido:~ tobis$ /usr/local/mysql/bin/mysql
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.1.30 MySQL Community Server (GPL)

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.


MySql is running! Type quit . This is enough of a victory for one day.


In future if you want to just type mysql instead of
/usr/local/mysql/bin/mysql, you need to update your path.

Change to your home directory. Issue

touch .profile

Then edit .profile, appending the line

export PATH="$PATH:/usr/local/mysql/bin"

Note this is a hidden file. See


In future if you don't want to burden your machine with mysql anymore,

launchctl unload com.mysql.mysqld.plist

Next step Django itself. I am expecting it to be a bit easier.