首页 > 技术文章 > mysql--ERROR 2059 (HY000): Authentication plugin 'caching_sha2_password' cannot be loaded: /usr/lib64/mysql/plugin/caching_sha2_password.so: cannot open shared object file: No such file or directory

Xinenhui 2021-08-25 11:28 原文

问题背景:

 1、在授权机器上连接mysql 8.0的数据库,账号、密码都没有问题,报错

 2、使用 navicat工具连接8.0版本,报错

 

 

排查思路:

 可能是创建用户没有指定插件使用了8.0自带的插件,8.0版本的mysql的加密规则是 caching_sha2_password,需要改成 mysql_native_password

 

解决方案:

 1、服务器上mysql版本过低,重新安装8.0版本的mysql再连接即可。

 2、更换用户名

 3、修改加密规则

  1)使用root登录mysql,查看当前账号的加密规则

#查看mysql版本
select @@version;
#查看加密方式 show variables like
'default_authentication_plugin';
#查看用户信息
select host,user,plugin from mysql.user;

 

  2)修改加密方式(这使用test账号做测试)

alter user 'test'@'%' identified with mysql_native_password by 'password';

 

推荐阅读