MySql教程

client does not support consider.....upgading MYSQL client问题解决

本文主要是介绍client does not support consider.....upgading MYSQL client问题解决,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!

client does not support consider.....upgading MYSQL client问题解决

        • 一、报错的原因
        • 二、修改root加密方式为mysql_native_password:
        • 三、发现没生效,查看root用户有两条记录:
        • 四、修改root@%的加密方式
        • 五、查看user表是否修改成功:
        • 六、测试连接

MySQL是安装在虚拟机的,版本是8.0.22,本机使用SQLYog连接时,提示如下报错:
在这里插入图片描述
网上翻了一遍资料查看,都说执行以下两条命令都可以解决:

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

但修改之后发现还是不行。以下是自行摸索得到的解决步骤:

一、报错的原因

因为MySQL8.0以上版本使用的密码加密方式发生了改变,使用的是caching_sha2_password,而SQLYog客户端使用的还是mysql_native_password加密方式连接。可以通过查看user表可以知道:

select user,plugin from mysql.user;

二、修改root加密方式为mysql_native_password:

alter user 'root'@'localhost' identified with mysql_native_password by 'root';
flush privileges;

三、发现没生效,查看root用户有两条记录:

select user,plugin,host from mysql.user;

在这里插入图片描述

其中,host为%表示,表示的远程登录,并且是除服务器外的其他任何终端;
host为%表示localhost,表示可以在本地登录,即可以在服务器上登陆

而我使用的是windows的SQLYog连接虚拟机的Mysql,使用的root应该是host为%的root。而这个root的plugin还是caching_sha2_password,所以才导致了第二步并没有生效。

四、修改root@%的加密方式

mysql> alter user 'root'@'localhost' identified with caching_sha2_password by 'root';
Query OK, 0 rows affected (0.00 sec)
mysql> 
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)

五、查看user表是否修改成功:

在这里插入图片描述

六、测试连接

在这里插入图片描述
终于连上了!

这篇关于client does not support consider.....upgading MYSQL client问题解决的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!