java.sql.SQLException: Unable to load authentication plugin ‘caching_sha2_password‘.解决方法

问题描述:

今天遇到数据库版本问题,原来是mysql5.6,升级到8.0,连接数据库就报错:

Unable to load authentication plugin ‘caching_sha2_password’.


解决方案:

网上解决方案是修改数据库密码加密方式,不建议这么改

改两个地方:
1,修改pom.xml中的 mysql-connector-java 版本为8.x.xx
java.sql.SQLException: Unable to load authentication plugin ‘caching_sha2_password‘.解决方法_第1张图片
2,修改项目中数据库连接配置文件,改为 com.mysql.cj.jdbc.Driver
java.sql.SQLException: Unable to load authentication plugin ‘caching_sha2_password‘.解决方法_第2张图片


原因分析:

mysql8.x的新特性密码加密方式是 caching_sha2_password

mysql5.x密码加密使用的是 mysql_native_password

你可能感兴趣的:(MySQL问题汇总,mysql,java)