MySQL db problem in Python
Question: For me mysql db has been successfully instaled in my system.I verified through
the following code that it is successfully installed without any errors.

    
    
    C:\Python26>python
    Python 2.6.1 (r261:67517, Dec  4 2008, 16:51:00) [MSC v.1500 32 bit (Intel)] on
    win32
    Type "help", "copyright", "credits" or "license" for more information.
    >>> import MySQLdb
    >>>
    

But when I imported the mysqldb in my script its giving **No module name
MySQLdb.**

Kindly let me know the problem and the solution..

I am using python 2.6 and mysql is 4.0.3 in windows XP.

Thanks in advance...


Answer: 1) Try using your package manager to download **[python-
mysql](http://www.novell.com/products/linuxpackages/server10/i386/python-
mysql.html)** which includes MySQLdb.

2) Ensure `/usr/lib/python2.4/site-packages/` is in your
[PYTHONPATH](http://docs.python.org/using/cmdline.html#envvar-PYTHONPATH),
e.g.:

    
    
    >>> import sys
    >>> from pprint import pprint
    >>> pprint(sys.path)
    ['',
     '/usr/lib/python2.4',
     '/usr/lib/python2.4/plat-linux2',
     '/usr/lib/python2.4/lib-tk',
     '/usr/lib/python2.4/site-packages']
    

3) You seem to be using the correct capitalization in your example, but it
bears mentioning that the module name is case-sensitive, i.e. MySQLdb
(correct) != mysqldb (incorrect).

**Edit** : Looks like nilamo has found the problem. As mentioned in a comment:
you might be running your script with Python 2.6, but MySQLdb is installed in
2.4's site-packages directory.

