I need to use Python to connect to a database that uses the mysql_old_password authentication plugin. I do not have db admin access so I cannot change this setting, so please do not suggest that.
I just installed the MySQLdb module, downloaded here. Other stackoverflow questions on this matter have led me to believe that it is possible to use the old authentication with this module, but when I set up my connection (db info removed for privacy reasons), I get the following error:
('Unexpected error:', <class '_mysql_exceptions.OperationalError'>)
Traceback (most recent call last):
File "convert_db.py", line 48, in <module>
File "convert_db.py", line 25, in main
prod_con = MySQLdb.connect('xxxx', 'xxxx', 'xxxx', 'xxxx')
File "/Library/Python/2.7/site-packages/MySQLdb/__init__.py", line 81, in Connect
return Connection(*args, **kwargs)
File "/Library/Python/2.7/site-packages/MySQLdb/connections.py", line 193, in __init__
super(Connection, self).__init__(*args, **kwargs2)
_mysql_exceptions.OperationalError: (2059, "Authentication plugin 'mysql_old_password' cannot be loaded: dlopen(/usr/local/mysql/lib/plugin/mysql_old_password.so, 2): image not found")
mysql_old_password support was removed from the mysql client libraries in 5.7.5, so you're probably using a newer version of the client libraries then that.
You'll have to downgrade your client library version if you need to connect to a server using old password authentication.