Setting up Django with MySQL on Mac OS X Lion

January 16, 2012

Surprisingly, this is a lot more annoying that I thought it would be. Some notes to the forgetful future me:

  1. Download the MySQL .dmg installer (64-bit). The registration form can be skipped.
  2. Install MySQL, the MySQLStartupItem, and the MySQL.prefPane in that order (See
  3. Open up the MySQL preference pane and make sure the server is started.
  4. Edit ~/.bash_profile and make sure that the mysql bin directory is in the path (/usr/local/mysql/bin). (The MySQL-python package needs to call mysql_config)
  5. Add a libmysqlclient symlink: sudo ln -s /usr/local/mysql/lib/libmysqlclient.18.dylib /usr/lib/libmysqlclient.18.dylib
  6. pip install MySQL-python

Phew. Don’t forget to update your django SETTINGS file for running locally:

    'default': {
        'ENGINE': 'django.db.backends.mysql',
        'USER': USER,
        'HOST': 'localhost'