Navicat 连接 MySQL 报错:Authentication plugin ‘caching_sha2_password‘ cannot be loaded

错误描述

在使用 Navicat Premium 12 连接 MySQL 数据库的时候报错: Authentication plugin ‘caching_sha2_password’ cannot be loaded
在这里插入图片描述

错误原因

原因是 mysql8 以前版本的加密规则是 mysql_native_password,但是在 mysql8 之后版本的加密规则是 caching_sha2_password

解决办法

mysql 用户登录密码加密规则还原为 mysql_native_password

步骤:

1. Windows + CMD 命令窗口,输入命令登录MySQL

mysql -u root -p

输入正确密码登录。

2. 修改加密规则

alter user 'root'@'localhost' identified by 'password' password expire never;

3. 更新登录密码

alter user 'root'@'localhost' identified with mysql_native_password by 'password';

4. 刷新权限

 FLUSH PRIVILEGES;

5. 重置密码

alter user 'root'@'localhost' identified by '输入你要修改的登录密码';

操作截图:
在这里插入图片描述
重新连接成功:
在这里插入图片描述

猜你喜欢

转载自blog.csdn.net/qq_40542534/article/details/117997127