错误代码2058&2059&1251-更改mysql8的加密方式由 caching_sha2_password到mysql_native_password

一、错误

由于mysql客户端软件只支持mysql5使用mysql_native_password,而mysql8版本使用的是caching_sha2_password,所以连接报错。需要手动更改mysql8的加密方式由 caching_sha2_password到mysql_native_password。

MySql错误 1251 - Client does not support authentication protocol requested by server
错误号码2058:Plugin caching sha2_password could not be loaded
2059 - Authentication plugin ‘caching_sha2_password’ cannot be loaded

在这里插入图片描述

在这里插入图片描述
在这里插入图片描述

二、执行过程

//显示数据库
show databases ; 

// 使用名为Mysql的数据库
use mysql ;    

//显示表
show tables;    

//查询
select user,plugin from user where user = 'root' ; 
 
 //改变caching_sha2_password为 mysql_native_password 
alter user 'root'@'localhost' identified with mysql_native_password by '111111' ;  
 
 // 再次查询是否修改成功
select user,plugin from user where user = 'root' ;

三、过程截图

在这里插入图片描述
进入客户端软件查询也证实已经修改成功:
在这里插入图片描述

猜你喜欢

转载自blog.csdn.net/qyfx123456/article/details/129890502