NotSupportedError :( NotSupportedError)身份验证插件' mysql_old_password'不受支持

时间:2014-09-12 19:07:12

标签: mysql python-2.7 pandas sqlalchemy

我试图连接到远程MySQL服务器,特别是使用Python 2.7 / pandas / sqlalchemy。

我安装了mysql-connector-python,然后在我的终端启动了iPython,然后尝试了:

import pandas as pd
from pandas import Series, DataFrame
from sqlalchemy import create_engine

engine = create_engine('mysql+mysqlconnector://scott:tiger@localhost:3306/foo')
test_q = pd.read_sql_query('SELECT COUNT(users.id) FROM users', engine)

当然,这里的create_engine()不是实际的连接,它只是一个例子。

我收到错误:

NotSupportedError: (NotSupportedError) Authentication plugin 'mysql_old_password' is not supported None None

我很难理解这个错误以及如何解决它。我认为可能存在一些事实,即我只是将密码作为字符串发送,而可能需要some type encryption

所以基于this documentation,我试过了:

import hashlib
hash_object = hashlib.sha256(b'tiger')
engine = create_engine('mysql+mysqlconnector://scott:' + hash_object + '@localhost/foo')

提出错误:

TypeError: cannot concatenate 'str' and '_hashlib.HASH' objects

所以现在我认为我需要使用the engine creation API来创建连接对象。 custom dbapi connection可能是另一种可能性,但我仍然处于亏损状态,但遵循了其中任何一个的指示。有什么想法吗?

0 个答案:

没有答案
相关问题