MySQLdb Installation

3 replies [Last post]
User offline. Last seen 5 years 51 weeks ago. Offline
Joined: 04/01/2011

I just wanted to share my experience installing the MySQLdb module on my laptop, which is running Mac OSX 10.6.7 and python 2.7.

I had a couple of obstacles:

1. I had to download and install the package setuptools:

2. Then I was able to properly install MySQLdb, but when I would try to import it for use, I was getting an error associated with locating libmysqlclient.18.dylib. The solution I chose was to add the following line to my .bash_profile:

export DYLD_LIBRARY_PATH=/usr/local/mysql/lib/

Although I found reference to multiple other solutions online. Hopefully this is helpful to others that run into the same problem.


User offline. Last seen 5 years 44 weeks ago. Offline
Joined: 12/13/2011
Lion comments

The easiest way I found to get MySQLdb running on Lion was to do this.

1. Install the python package manager pip:

sudo easy_install pip

2. Install MySQLdb:

sudo pip install mysql-python

3. Add the DYLD_LIBRARY_PATH to .bash_profile as explained by jtladner above.

User offline. Last seen 3 years 30 weeks ago. Offline
Joined: 08/15/2010
Installing MySQLdb in Lion

Thanks! Yes. It's often easiest to let a package manager handle the installation for you, when available. We appreciate you taking the time to help others.

User offline. Last seen 17 hours 35 min ago. Offline
Joined: 08/04/2010

That is great. Thanks for reporting your experience with Snow Leopard. It will be interesting to see if/how things change with Lion.