将 MySQLdb Python 模块与 mysql_old_password 一起使用
Using MySQLdb Python module with mysql_old_password
我需要使用 Python 连接到使用 mysql_old_password 身份验证插件的数据库。我没有数据库管理员权限,所以我无法更改此设置,所以请不要建议。
我刚刚安装了 MySQLdb 模块,下载了 here。关于这个问题的其他 Whosebug 问题让我相信可以使用这个模块的旧身份验证,但是当我设置我的连接时(出于隐私原因删除了数据库信息),我收到以下错误:
('Unexpected error:', <class '_mysql_exceptions.OperationalError'>)
Traceback (most recent call last):
File "convert_db.py", line 48, in <module>
main()
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")
这似乎表明我只需要从某个地方下载插件图像 - 这可能吗?或者是否有一些我可以使用 MySQLdb 设置的字段允许我连接?
mysql_old_password
支持已从 5.7.5 中的 mysql 客户端库中删除,因此您可能使用的客户端库版本较新。
如果您需要使用旧密码身份验证连接到服务器,则必须降级客户端库版本。
您也可以尝试 pymysql instead of MySQLdb, which should still have 支持旧密码哈希。
为了连接到仍然使用 old_password 的数据库服务器,我使用了 pymysql。
所有其他模块都给出错误 'Malformed Packet'
我需要使用 Python 连接到使用 mysql_old_password 身份验证插件的数据库。我没有数据库管理员权限,所以我无法更改此设置,所以请不要建议。
我刚刚安装了 MySQLdb 模块,下载了 here。关于这个问题的其他 Whosebug 问题让我相信可以使用这个模块的旧身份验证,但是当我设置我的连接时(出于隐私原因删除了数据库信息),我收到以下错误:
('Unexpected error:', <class '_mysql_exceptions.OperationalError'>)
Traceback (most recent call last):
File "convert_db.py", line 48, in <module>
main()
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")
这似乎表明我只需要从某个地方下载插件图像 - 这可能吗?或者是否有一些我可以使用 MySQLdb 设置的字段允许我连接?
mysql_old_password
支持已从 5.7.5 中的 mysql 客户端库中删除,因此您可能使用的客户端库版本较新。
如果您需要使用旧密码身份验证连接到服务器,则必须降级客户端库版本。
您也可以尝试 pymysql instead of MySQLdb, which should still have 支持旧密码哈希。
为了连接到仍然使用 old_password 的数据库服务器,我使用了 pymysql。 所有其他模块都给出错误 'Malformed Packet'