python - 重复 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'
)
解决方案
尝试
pip uninstall mysql-connector-python
和
pip install mysql-connector-python
在 windows 命令行窗口中。
如果失败,请尝试
reconfigure
MySql 服务器
从MySql installer
然后Use Legacy Authentication Method (Retain MySql 5x Compatibility)
选择Authentication Method
Reconfiguring MySql server
并reinstalling mysql connector python
删除了我的错误
推荐阅读
- java - 如何在忽略java中的第一个索引的同时删除ArrayList中的重复字符串数组
- apache - Radicale 与 uwsgi 和 Apache 与 Debian:连接被拒绝
- python - 子类上的 singledispatchmethod 的解决方法
- python - 应用于熊猫系列时更改其他列值
- html - 如何使用 CSS 拉伸背景 rgba?
- sql-server - 如何将单列表转换为 2 列表
- c++ - 我是否错误地从 CLion 中的文件中获取环境变量,或者 env 文件语法不正确?
- javascript - 如何使用 Jest 和 NestJS 模拟 Mongoose 的“lean()”查询?
- javascript - 如何在带有过滤器的Vue模板中使用三元运算符?
- graphql - 将变量传递给`mutation` apollographql 服务器