Python Mysqldb - Error 1045: Access Denied For User
I have a python code that goes like import MySQLdb import sys try: con = MySQLdb.connect(host = 'localhost',user = 'crawler',passwd = 'crawler', db = 'real_estate_analytics')
Solution 1:
'localhost' is and has always been special with MySQL. In your case, you grant crawler@localhost some privileges and this would mean 'the user crawler connecting through UNIX socket'. And, I'm pretty sure the MySQL server is configured with --skip-networking.
This can be fixed by being explicit. Using the unix_socket connection argument of your database driver, it would force the use of the UNIX socket. (Shamelessly linking to MySQL Connector/Python docs, as I'm the maintainer of that driver).
Post a Comment for "Python Mysqldb - Error 1045: Access Denied For User"