Python MySQLdb package for Debian

I try to use MySQLdb module with my Python code for the first time. This is what I see:

import MySQLdb
Traceback (most recent call last):
File "", line 1, in
ImportError: No module named MySQLdb
your code here

For Debian, the package for MySQLdb module is python-mysqldb.

# apt-get install python-mysqldb

Now, let’s verify if MySQLdb module has been correctly installed:

>>> import MySQLdb

No more import error message, which means you can start using MySQldb module now.

One thought on “Python MySQLdb package for Debian

  1. PC Repair

    But if you’re on Windows XP, how would you get it running? We have a client that came in with his computer and also needed to get MySQL and Python working on the computer. Most of the solutions so far relate to UNIX/Linux and nothing for Windows users.

    Would be grateful if you could show how to get it running on Windows.


Leave a Reply

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