Cannot connect to Mysql database

Himanshu Garg hgarg.india at
Tue Nov 19 07:03:03 CET 2013

I have written the script as:

import os
import MySQLdb as mdb

con = mdb.connect(host="", user="root", passwd="password")
print "opened"

But when I execute, I get the following error:

"File "/usr/lib/python2.7/dist-packages/MySQLdb/", line 80, in Connect
ImportError: No module named connections"

I have checked there is a module in the above directory.  Also, when I run the script without doing chroot, it works perfectly.

More information about the Python-list mailing list