MySQLdb Installation

3 replies [Last post]
jtladner
User offline. Last seen 5 years 31 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: http://pypi.python.org/pypi/setuptools#files

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.

Jason

rrock
User offline. Last seen 5 years 24 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.

Steve
User offline. Last seen 3 years 10 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.

pcfb
User offline. Last seen 21 hours 32 min ago. Offline
Joined: 08/04/2010
Thanks

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