![远程连接mysql8.0,Error No.2058 Plugin caching_sha2_password could not be loaded 远程连接mysql8.0,Error No.2058 Plugin caching_sha2_password could not be loaded](https://image.shishitao.com:8440/aHR0cHM6Ly9ia3FzaW1nLmlrYWZhbi5jb20vdXBsb2FkL2NoYXRncHQtcy5wbmc%2FIQ%3D%3D.png?!?w=700&webp=1)
通过本地去连接远程的mysql时报错,原因时mysql8.0的加密方法变了。
mysql8.0默认采用caching_sha2_password的加密方式
第三方客户端基本都不支持这种加密方式,只有自带的命令行支持
所以需要修改加密方式。
首先进入mysql命令行
[root@localhost ~]# mysql -u root -p
Enter password:
第一步:修改加密方式
ALTER USER'root'@'localhost' IDENTIFIED BY 'Qigaoxiang2018@' PASSWORD EXPIRE NEVER;
第二步:重新修改密码
ALTER USER'root'@'%' IDENTIFIED WITH mysql_native_password BY 'Qigaoxiang2018@';
第三步:刷新(不做可能无法生效)
FLUSH PRIVILEGES;
之后可以成功连接。