When you write a Python program to interact with your MySQL database you need to include the following library:

import MySQLdb

Doing this without properly installing the MySQLdb library to the correct version of Python will result in the following error when running the program:

 No module named MySQLdb

When I tried to run the Wiki Scrape I received this error:

No module named MySQLdb

So I ran

easy_install mysql-python

to see if that would work. It didn’t. So I logged in to my Oracle account and went to

http://dev.mysql.com/downloads/connector/python/

and downloaded the MySQL Connector/Python Windows MSI Installer for Python 2.7.

When it finished installing I tried again. Still didn’t work. So I went to SourceForge.net:

http://sourceforge.net/projects/mysql-python/

and downloaded the MySQL-python-1.2.4b4.win32-py2.7.exe, and again it didn’t work.

The Solution

The problem was that I was running a 64-bit version of Python 2.7 so I needed to go and find a 64-bit MySQLdb library. I eventually found one here:

http://blog.victorjabur.com/2011/06/08/modules-python-library-compiled-for-windows-32-and-64-unofficial-windows-binaries-for-python/

downloaded it, and ran it. It immediately recognised my 64-bit version of Python 2.7 and installed perfectly. That’s all I had to do. I restarted my Python 2.7 GUI and re-ran my program and the library loaded correctly.