Guys I installed mySQLdb in Ubuntu with:

mydeskt@mydeskt-desktop:~$ sudo apt-get install python-mysqldb

but when I go to the python interpreter and type:

>>> import mySQLdb

I get:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named mySQLdb

It is installed though, because when I go to:

System > Administration > Synaptic Package Manager and type mysql I can see:

python-mysqldb as installed.


why does it not work?

You misspelled it.

import MySQLdb

The directory's name containing a file named __init__.py can be imported.

You misspelled it.

import MySQLdb

The directory's name containing a file named __init__.py can be imported.

sir, you are a life saver. :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.