Installing Python Mysql Adapter On Mac OSX

By | February 12, 2013

python-logologo-mysql-110x57

  1. First download and install mysql for Mac OSX
  2. Install virtualenv, create a virtualenv and activate it
  3. Pip install mysql-python, and you will see an error “EnvironmentError: mysql_config not found”
  4. Find the mysql_config by running “sudo find / -name ‘mysql_config'”
  5. Go to your /path to virtualenv/build/mysql-python
  6. Edit site.cfg
  7. Uncomment this line “#mysql_config = /usr/local/bin/mysql_config” and change the path to what you found in step 4
  8. Then run “python setup.py install”
  9. if you get “Library not loaded: libmysqlclient.18.dylib” when using the adapter
  10. Then symlink this file: “sudo ln -s /usr/local/mysql/lib/libmysqlclient.18.dylib /usr/lib/libmysqlclient.18.dylib”

To control the server:

sudo /Library/StartupItems/MySQLCOM/MySQLCOM stop
sudo /Library/StartupItems/MySQLCOM/MySQLCOM start
sudo /Library/StartupItems/MySQLCOM/MySQLCOM restart

One thought on “Installing Python Mysql Adapter On Mac OSX

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.