Nickey Production
Nickey Production

Reputation: 13

Python can't connect to MySQL db: OperationalError

When in the Python shell I type:

import MySQLdb
Con = MySQLdb.Connect(user='testuser', password='password', db='test')

And I get this:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Users\Nickey\AppData\Local\Programs\Python\Python36\lib\site-packages\MySQLdb\__init__.py", line 86, in Connect
    return Connection(*args, **kwargs)
  File "C:\Users\Nickey\AppData\Local\Programs\Python\Python36\lib\site-packages\MySQLdb\connections.py", line 204, in __init__
    super(Connection, self).__init__(*args, **kwargs2)
_mysql_exceptions.OperationalError: (2059, <NULL>)

And no description of the error at all. Please, I am waiting for help. Thanks.

UPDATE: In case somebody will be having this problem, it appears to be connected with the new mysql_auth_plugin, with its new Strong Password Encryption for Authentication. I just switched to old_password_plugin(Legacy Authentication Method) in the configuration of MySQL Server and now [All works!].

Upvotes: 1

Views: 1374

Answers (1)

eagle
eagle

Reputation: 900

According to the docs, password is not a keyword argument like you entered, instead it's passwd as you can see --> here

Upvotes: 2

Related Questions