mysql 报错Authentication method 'caching_sha2_password' is not supported.

原因:mysql版本身份验证引起的,

官网解释:https://dev.mysql.com/doc/refman/8.0/en/caching-sha2-pluggable-authentication.html

解决方法:

1.查询mysql数据库中user表plugin列的值,是否如下

mysql 报错Authentication method 'caching_sha2_password' is not supported.

如果不同请如下操作:

       1.1:ALTER USER 'root'@'localhost' IDENTIFIED BY 'password' PASSWORD EXPIRE NEVER; #修改加密规则 

        1.2:ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'password'; #更新一下用户的密码 

        1.3:FLUSH PRIVILEGES; #刷新权限 

        1.4:再重置下密码:alter user 'root'@'localhost' identified by '123456';

2.修改配置文件如下:

mysql 报错Authentication method 'caching_sha2_password' is not supported.

default_authentication_plugin=mysql_native_password添加到配置中。

3.重启服务。

4.完成