美文网首页
[已解决]mysql.connector.errors.NotS

[已解决]mysql.connector.errors.NotS

作者: pooncheukkei | 来源:发表于2021-06-12 12:04 被阅读0次

参考链接:https://www.pythonf.cn/read/126479

使用mysql-connector连接mysql数据的库的时候,遇到如下报错:
mysql.connector.errors.NotSupportedError: Authentication plugin 'caching_sha2_password' is not supported

1、mysql的版本问题,在mysql18之前的版本的加密规则是mysql_native_password,但是mysql18的是caching_sha2_password。所以需要修改加密规则,将其改为mysql_native_password。

登陆mysql,将root用户的加密方式改成mysql_native_password,如何查看现有的用户?

SELECT user, host, plugin from mysql.user;
现在的加密规则都为caching_sha2_password


ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '你自己的密码';


2、上面的步骤执行完之后,还有存在上面的报错,在经过查找,发现除了mysql-connector之外,还需要安转一些python专属的文件:
pip install MYSQL-connector-python

DONE!

相关文章

网友评论

      本文标题:[已解决]mysql.connector.errors.NotS

      本文链接:https://www.haomeiwen.com/subject/oszbeltx.html