java.sql.SQLException: Unable to load authentication plugin ‘caching_sha2_password‘.
java.sql.SQLException: Unable to load authentication plugin ‘caching_sha2_password’.这个报错。
1.主要原因8.x版本的验证模块和之前版本不同:
5.x版本是:default_authentication_plugin=mysql_native_password
8.x版本就是:default_authentication_plugin=caching_sha2_password
解决方法是:
更新mysql驱动的jar版本,可以修改为8.0.11版本
还有 8以上的注册驱动要加cj com.mysql.cj.jdbc.Driver
url后面要加?serverTimezone=GMT%b8 jdbc:mysql://localhost:3306/表?serverTimezone=GMT%b8