将SQLAlchemy连接到MySQL时用户名失败

将SQLAlchemy连接到MySQL时用户名失败,sqlalchemy,mysql-connector-python,Sqlalchemy,Mysql Connector Python,我正在尝试通过SQLAlchemy将python web应用程序连接到本地数据库 我已配置以下连接字符串: sqlalchemy.url = mysql+mysqlconnector://root:root@localhost:3306/db_mother 当我使用上述方法时,经过长时间的堆栈跟踪后,会出现以下错误: sqlalchemy.exc.ProgrammingError:ProgrammingError 1045 28000:使用密码拒绝用户“root”@“localhost”的访问

我正在尝试通过SQLAlchemy将python web应用程序连接到本地数据库

我已配置以下连接字符串:

sqlalchemy.url = mysql+mysqlconnector://root:root@localhost:3306/db_mother
当我使用上述方法时,经过长时间的堆栈跟踪后,会出现以下错误:

sqlalchemy.exc.ProgrammingError:ProgrammingError 1045 28000:使用密码拒绝用户“root”@“localhost”的访问:无

将连接字符串更改为以下内容时:

sqlalchemy.url = mysql+mysqlconnector://ripley:amanda@localhost:3306/db_mother
我收到一个预期错误,因为该用户未在数据库中配置该密码:

sqlalchemy.exc.ProgrammingError: (ProgrammingError) 1045 (28000): Access denied for user 'ripley'@'localhost' (using password: YES) None None
所以,在第一种情况下,我有一个有效的db用户和密码,我可以使用它通过命令行或SequelPro连接,它说我没有使用密码。在第二种情况下,它似乎理解有一个密码。为什么一开始就没有这种理解呢

我正在使用python3、sqlalchemy、mysql连接器python和pyramid。还需要注意的是,如果我从root用户中删除密码,它就可以正常工作