Calvin's

Icon

designs and hacks. people and products.

No module named mysqldb

Python MySQL on Mac

Attempting to run a python/django application today which depended on a legacy MySQL db, I encountered:

No module named mysqldb

Apparently, I am missing the python interface library to MySQL, so here’s the easy solution to it:

sudo port -v install py26-mysql

WARNING: The download and installation process could take a while! :-)  About 30 minutes for my case.

As I was using Python 2.6.4 previously, the installation process also upgraded my Python to 2.6.6 since py26-mysql depends on the Python 2.6.6.

Back to coding!