首页 > 解决方案 > 重复 NotSupportedError: Authentication plugin 'caching_sha2_password' is not supported 尝试了以前的解决方案无济于事

问题描述

当我尝试通过 jupyter 笔记本连接到数据库时,我不断收到错误消息。我尝试了所有解决方案,例如: 重新安装 mysql-connector-python (没有工作) 传递争论auth_plugin='mysql_native_password' 确保 mysql 是最新的并且与我的 python 版本(3.9)匹配 我已经尝试了所有方法,但我仍然得到错误。

这是我的代码:

mydb = mysql.connector.connect(
    host = 'localhost',
    user = 'root',
    passwd = 'oxxmcN4Fer7@HQie',
    database = 'testdb',
    auth_plugin='mysql_native_password'
)

标签: pythonmysqljupyter-notebook

解决方案


尝试

pip uninstall mysql-connector-python

pip install mysql-connector-python  

在 windows 命令行窗口中。

如果失败,请尝试

reconfigureMySql 服务器

MySql installer

然后Use Legacy Authentication Method (Retain MySql 5x Compatibility) 选择Authentication Method

Reconfiguring MySql serverreinstalling mysql connector python删除了我的错误


推荐阅读