连接Docker中mysql 出现:Unable to load authentication plugin 'caching_sha2_password'.

在IDEA中连接远程或是虚拟机中Docker的mysql 出现错误如下:java.sql.SQLException: Unable to load authentication plugin ‘caching_sha2_password’.

5.7版本是:default_authentication_plugin=mysql_native_password
8.x版本就是:default_authentication_plugin=caching_sha2_password

查看idea中pom的依赖包版本号
在这里插入图片描述
pom文件中无法直接查看版本号(可以通过在pom文件中右键单击->Diagrams->ShowDependies…点击依赖进行查看)
在这里插入图片描述
mysql驱动已经更新适配了caching_sha2_password 的密码规则,升级到最新版本就可以了,如将版本改为8.0.11版本
在这里插入图片描述
重启Java服务器即可…
若还是有其他错误,欢迎留言,如能帮助,我会尽快回复…

猜你喜欢

转载自blog.csdn.net/weixin_42184538/article/details/86526845