mysql.connector.errors.NotSupportedError: Authentication plugin 'caching_sha2_password' is not supported
今天将程序部署到服务器,遇到
mysql.connector.errors.NotSupportedError: Authentication plugin 'caching_sha2_password' is not supported
问题产生的原因:
从MySQL 8.0开始,默认的用户认证插件从mysql_native_password变成了caching_sha2_password
查看现有的用户
mysql> select user, host, plugin from mysql.user;
+------------------+-----------+-----------------------+
| user | host | plugin |
+------------------+-----------+-----------------------+
| root | % | mysql_native_password |
| test1| % | caching_sha2_password |
| mysql.infoschema | localhost | caching_sha2_password |
| mysql.session | localhost | caching_sha2_password |
| mysql.sys | localhost | caching_sha2_password |
+------------------+-----------+-----------------------+
使用连接mysql的账号test1加密规则为 caching_sha2_password
修改加密规则
ALTER USER 'test1'@'%' IDENTIFIED WITH 'mysql_native_password' BY 'password'; FLUSH PRIVILEGES;
更新mysql-connector库
pip install --upgrade mysql-connector-python
【推荐】博客园携手 AI 驱动开发工具商 Chat2DB 推出联合终身会员
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步