Linux远程连接mysql 出错plugin caching_sha2_password could not be loaded:

问题描述:

今天使用SQLyog远程连接mysql时出错plugin caching_sha2_password could not be loaded问题。
Linux远程连接mysql 出错plugin caching_sha2_password could not be loaded:_第1张图片
但在本地cmd 进入命令行窗口:输入命令连接远程连接mysql,发现可以顺利连接。

Linux远程连接mysql 出错plugin caching_sha2_password could not be loaded:_第2张图片

主要问题是 MySQL可视化工具(如: sqlyog )和 MySQL 服务密码校验规则是否一致,mysql 5.7 默认密码校验规则是mysql_native_password,MySQL 8.0 时默认为 caching_sha2_password,可以进入MySQL ,使用 SELECT Host, User, plugin from mysql.user; 查看


解决方案:

通过命令行方式远程连接到mysql,然后依次输入以下命令

# 修改远程登陆
# 修改密码过期规则----》永不过期
ALTER USER 'root'@'%' IDENTIFIED BY '123' PASSWORD EXPIRE NEVER; 
# 更新用户的密码修改加密规则
ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY '123';
# 刷新权限
FLUSH PRIVILEGES;
# 重置密码(==非必须==)
ALTER USER 'root'@'%' IDENTIFIED BY '123';

然后,输入SELECT Host, User, plugin from mysql.user; 查看校验规则,发现已经改变。
Linux远程连接mysql 出错plugin caching_sha2_password could not be loaded:_第3张图片

再次连接,连接成功。
Linux远程连接mysql 出错plugin caching_sha2_password could not be loaded:_第4张图片

你可能感兴趣的:(数据库,linux,mysql)