[mysql] [navicate] 1251

[mysql] [navicate] 1251 - Client does not support authentication protocol requested by server

客户端使用navicat for mysql。本地安装了mysql 8.0。但是在链接的时候提示:

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

主要原因是mysql服务器要求的认证插件版本与客户端不一致造成的。

打开mysql命令行输入如下命令查看,系统用户对应的认证插件:

select user, plugin from mysql.user;

img

可以看到root用户使用的plugin是caching_sha2_password,mysql官方网站有如下说明:

Important

The caching_sha2_password authentication plugin on the server requires new versions of connectors and clients, which add support for the new MySQL 8.0 default authentication.

意思是说caching_sha2_password是8.0默认的认证插件,必须使用支持此插件的客户端版本。

plugin的作用之一就是处理后的密码格式和长度是不一样的,类似于使用MD5加密和使用base64加密一样对于同一个密码处理后的格式是不一样的。

解决方法:

我不希望更新本地的客户端版本,想直接使用原来的环境来链接。

解决方法是将root的plugin改成mysql_native_password。相当于降了一级。

mysql官方网站提供了从mysql_old_password升级到mysql_native_password,我们可以仿照这个。

alter user 'root'@'%' identified with mysql_native_password by "123456";
flush privileges;

这行代码有两层含义,第一:修改root的密码为'root',摒弃原来的旧密码。第二:使用mysql_native_password对新密码进行编码。

修改完成后再用客户端登陆成功:

img

成功!

原文地址:https://www.cnblogs.com/ryxiong-blog/p/12518573.html