原因:mysql版本身份验证引起的,
官网解释:https://dev.mysql.com/doc/refman/8.0/en/caching-sha2-pluggable-authentication.html
解决方法:
1.查询mysql数据库中user表plugin列的值,是否如下
(mysql中user表)
select plugin, authentication_string from user;

如果不同请如下操作:
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.修改配置文件如下:
把default_authentication_plugin=mysql_native_password添加到配置中。
3.重启服务。
4.完成
版权声明:本文为CSDN博主「谷鸣小道」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/u011583336/article/details/80999043