navicat连接MySQL数据库的时候报:2059 - Authentication plugin ‘caching sha2 password’ cannot be loaded

navicat连接MySQL数据库的时候报:2059 - Authentication plugin ‘caching sha2 password‘ cannot be loaded_mysql

一、问题原因、

MySQL 8.0之前的版本默认使用mysql_native_password作为加密规则,而MySQL 8.0及之后版本则默认使用caching_sha2_password。这种变更可能是导致(某问题)的主要原因。

二、解决办法

# 连接 mysql 服务器
mysql -u root -p

# 进入 mysql 数据库
mysql> use mysql;

# 查看 user 表
mysql> select user,host from user;

# 设置登录密码永不过期
mysql> alter user 'root'@'localhost' identified by 'password' password expire never;

mysql> alter user 'root'@'%' identified by 'password' password expire never;

# 修改加密规则
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