MySQL & Python on Mac

I don’t have MySQL installed globally, so need to do this dance every time I add it to a new virtualenv:

  1. Install the bindings in the virtual env. The package name is MySQL-python.
  2. Symlink libmysqlclient.18.dylib from the /usr/local/mysql/lib tree into site-packages of the virtualenv
  3. Add the following to the virtual env’s activate script::
    DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:/path/to/venv/site-package
  4. optionally add /usr/local/mysql/bin to PATH as well.