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

发布时间:2023-05-22 09:26:01

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

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

  1. 问题描述

在项目开发过程中,由于安装了独立的mysql数据库,而不是集成了wamserver等全家桶等服务器。这导致了上述问题。虽然我们知道mysql服务拒绝了客户端的连接请求,但在使用以下指令授权root用户后仍然不可能。

grant all privileges on *.* to 'root' @'%' with grant option;

  1. 问题解决 在参考了 mysql服务设置远程连接的博文成功解决,感谢大佬们的分享,解决了这个烦人的问题。 假作次博文,以免下次遇到类似问题无法解决。 首先,通过命令行登录mysql服务。

mysql -u root -p

登录成功后,将数据库切换到mysql

use mysql

查询保存信息的密码

select host,user,plugin,authentication_string from mysql.user;

client does not support authentication protocol requested by server;consider upgrading MySQL client_数据库_02

此时,发现所有用户的plugin字段数据都是在sha2加密后保存的,因此在客户端发起连接时,密码不匹配,导致授权失败。

修改密码并指定密码保存格式

ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY 'yourpassword';

重新查询

select host,user,plugin,authentication_string from mysql.user;

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

此时看到root用户的密码保存方式已经改为本地方式。

到这一步,如果还不能解决,那么再次授权。

grant all privileges on *.* to 'root' @'%' with grant option;

这个问题可以解决。

好的记忆力不如坏的笔头好。只有久而久之,我们才能爬得远远的__

上一篇 redis删除key
下一篇 JavaSE的简单了解

文章素材均来源于网络,如有侵权,请联系管理员删除。

标签: Java教程Java基础Java编程技巧面试题Java面试题