成长的路程,就像一个闹钟变成了四个闹钟
1. 前置理解
- 2058和2059的错误码核心都是你用的客户端工具和mysql版本的密码插件不匹配。
- 2058一般这个错误通常发生在使用 SQLyog 客户端工具连接 MySQL 5.7 及以上版本时。
- 2059一般这个错误通常发生在使用 Navicat 客户端工具连接 MySQL 8.0 及以上版本时。
2.报错现象
- 2058
Authentication plugin 'mysql_native_password' cannot be loaded
- 2059
Authentication plugin 'caching_sha2_password' cannot be loaded
3.解决办法(敲重点!!!)
- 修改MySQL8的加密规则!!!
# 连接 mysql 服务器
mysql -u root -p
# 进入 mysql 数据库
mysql> use mysql;
# 查看 user 表
mysql> select user,host from user;
# 设置登录密码永不过期(password改为自己的)
mysql> alter user 'root'@'localhost' identified by 'password' password expire never;
mysql> alter user 'root'@'%' identified by 'password' password expire never;
# 修改加密规则(password改为自己的)
mysql> alter user 'root'@'localhost' identified with mysql_native_password by 'password';
mysql> alter user 'root'@'%' identified with mysql_native_password by 'password';
# 刷新权限
mysql> flush privileges;
# 退出
mysql> quit
您的支持是我创作的无限动力
希望我能为您的未来尽绵薄之力
如有错误,谢谢指正;若有收获,谢谢赞美