java.sql.SQLException: Unable to load authentication plugin ‘caching_sha2_password’
微服务连接MySQL8.0报错:
java.sql.SQLException: Unable to load authentication plugin 'caching_sha2_password'
分析:
5.x版本是:default_authentication_plugin=mysql_native_password
8.x版本就是:default_authentication_plugin=caching_sha2_password
解决办法:
修改项目中MySQL依赖为8.x版本
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>8.0.23</version>
</dependency>