I am using Python 2.7, MySQl 5.5, mysqldb(driver) and trying to connect to the mysql db using Python.
What I have tried
import MySQLdb
db = MySQLdb.connect(host="localhost",
user="root", # username
passwd="xxxxx", # password
db="TEST") # name of the data base
Even tried 127.0.0.1 as local host
#ERROR
Traceback (most recent call last):
File "C:/Python27/connect.py", line 6, in <module>
db="prakash") # name of the data base
File "C:\Python27\lib\site-packages\MySQLdb\__init__.py", line 81, in Connect
return Connection(*args, **kwargs)
File "C:\Python27\lib\site-packages\MySQLdb\connections.py", line 187, in __init__
super(Connection, self).__init__(*args, **kwargs2)
OperationalError: (2003, "Can't connect to MySQL server on 'localhost' (10061)")
I am new to python, please help how to proceed?