You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Tested on Ubuntu 16.04 with Python 2.7.12 and MySQL 5.7.24
Example session
root@myhost:/tmp# cat my.py
import MySQLdb
MySQLdb.connect(host="127.0.0.1",user="root",passwd="wrong")
root@myhost:/tmp# pip list | grep mysql
mysqlclient 1.3.14
root@myhost:/tmp# mysql -u root --password=wrong -h 127.0.0.1
mysql: [Warning] Using a password on the command line interface can be insecure.
ERROR 1045 (28000): Access denied for user 'root'@'127.0.0.1' (using password: YES)
root@myhost:/tmp# python my.py
Traceback (most recent call last):
File "my.py", line 2, in <module>
MySQLdb.connect(host="127.0.0.1",user="root",passwd="wrong")
File "/usr/local/lib/python2.7/dist-packages/MySQLdb/__init__.py", line 85, in Connect
return Connection(*args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/MySQLdb/connections.py", line 208, in __init__
super(Connection, self).__init__(*args, **kwargs2)
_mysql_exceptions.OperationalError: (2006, "Access denied for user 'root'@'127.0.0.1' (using password: YES)")
root@myhost:/tmp# pip uninstall mysqlclient
Uninstalling mysqlclient-1.3.14:
<snip>
root@myhost:/tmp# pip install mysqlclient==1.3.13
<snip>
Successfully installed mysqlclient-1.3.13
root@myhost:/tmp# mysql -u root --password=wrong -h 127.0.0.1
mysql: [Warning] Using a password on the command line interface can be insecure.
ERROR 1045 (28000): Access denied for user 'root'@'127.0.0.1' (using password: YES)
root@myhost:/tmp# python my.py
Traceback (most recent call last):
File "my.py", line 2, in <module>
MySQLdb.connect(host="127.0.0.1",user="root",passwd="wrong")
File "/usr/local/lib/python2.7/dist-packages/MySQLdb/__init__.py", line 85, in Connect
return Connection(*args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/MySQLdb/connections.py", line 204, in __init__
super(Connection, self).__init__(*args, **kwargs2)
_mysql_exceptions.OperationalError: (1045, "Access denied for user 'root'@'127.0.0.1' (using password: YES)")
The text was updated successfully, but these errors were encountered:
When connecting to MySQL with an invalid password, up until version 1.3.13 the following exception is raised by mysqlclient-python:
_mysql_exceptions.OperationalError: (1045, "Access denied for user 'root'@'127.0.0.1' (using password: YES)")
with version 1.3.14 and 1.4.0rc1 the following exception is raised instead:
_mysql_exceptions.OperationalError: (2006, "Access denied for user 'root'@'127.0.0.1' (using password: YES)")
Note the MySQL error code is now 2006 (normally representing "server has gone away") instead of code 1045 (Access denied).
This can easily be seen with the following python code:
Tested on Ubuntu 16.04 with Python 2.7.12 and MySQL 5.7.24
Example session
The text was updated successfully, but these errors were encountered: