MySQL错误代码2058和2059的解决办法

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

到此这篇关于MySQL错误代码2058和2059的解决办法的文章就介绍到这了,更多相关MySQL错误代码2058和2059内容请搜索站长网以前的文章或继续浏览下面的相关文章希望大家以后多多支持站长网!