I impored MySQLdb to use in python but i am getting the following error:
File "test.py", line 76, in <module>
db = Database()
File "test.py", line 18, in __init__
self.connection = MySQLdb.connect(host = self.host, user = self.user, passwd = self.passwd, db = self.db)
File "/home/ue/.pythonbrew/pythons/Python-2.7.5/lib/python2.7/site-packages/MySQLdb/__init__.py", line 81, in Connect
return Connection(*args, **kwargs)
File "/home/ue/.pythonbrew/pythons/Python-2.7.5/lib/python2.7/site-packages/MySQLdb/connections.py", line 193, in __init__
super(Connection, self).__init__(*args, **kwargs2)
_mysql_exceptions.OperationalError: (2002, "Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)")
Exception AttributeError: "Database instance has no attribute 'connection'" in <bound method Database.__del__ of <__main__.Database instance at 0xb74cf80c>> ignored
I have seen other posts but none of them is helping me. I can even restart mysql as I cannot find /var/run/mysqld/
I do not think there is an error in the code as it is from Mike Hibberts Python video lectures: http://www.youtube.com/watch?v=FFdNteScYe4&list=PLxxA5z-8B2xm1yUDAh2_pXGWBTePjCa3n
Would really really appreciate help in this.
test.py.