java.sql.SQLException: Unable to load authentication plugin 'caching_sha2_password'.

数据测试的时候出现:

网上查资料说的是mysql5.x 版本和 8.x版本的区别;

5.7版本是:default_authentication_plugin=mysql_native_password

8.x版本就是:default_authentication_plugin=caching_sha2_password

有网友说是 将my.ini 中的配置改成5.7 就可以了,但是my.ini在哪儿呢。。。。

安装目录:C:Program FilesMySQLMySQL Server 8.0 没有发现ini文件;

又继续查找。 结果是在隐藏的 programdata文件夹下面。。在win+r 出现运行里面输入 %programdata% ,文件夹就出来了;

终于找到,感激涕零啊。马上修改ini中的配置,重新服务器,发现还是不行。。。

继续Google。。。终于找到。mysql驱动已经更新适配了caching_sha2_password 的密码规则,升级到最新版本就可以了。

改为对应的数据库版本 :

<version>8.0.11</version>

原文地址:https://www.cnblogs.com/YuyuanNo1/p/12576469.html