解决连接 MySQL 出现的该问题

    • 1. 出现原因
    • 2. 解决方案
      • 2.1 升级更新
      • 2.2 更改 MySQL 的加密规则

Client does not support authentication protocol requested by server; consider upgrading MySQL client

1. 出现原因

无论是用 navicat 软件还是其他软件连接出现的此类问题,以及是语言前后端连接出现的此类问题。

基本上都是 mysql8 之前的版本中加密规则是mysql_native_password, 而在 mysql8 之后, 加密规则是caching_sha2_password 导致的.

2. 解决方案

2.1 升级更新

将使用的软件, 插件或者是框架等用于连接 mysql 的进行更新

2.2 更改 MySQL 的加密规则

-- 修改加密规则 password 为密码
alter user 'root'@'%' identified by 'password' password expire never;
alter user 'root'@'%' identified with mysql_native_password by 'password';
-- 刷新权限
FLUSH PRIVILEGES;
-- 查看修改的内容
select user,host,plugin from user where user='root';

更多推荐

解决连接MySQL出现Client does not support authentication protocol requested by server;