最近遇到了?java.sql.SQLException: Unable to load authentication plugin 'caching_sha2_password'.這個(gè)報(bào)錯(cuò)。
主要原因8.x版本的驗(yàn)證模塊和之前版本不同:
5.x版本是:default_authentication_plugin=mysql_native_password
8.x版本就是:default_authentication_plugin=caching_sha2_password
?
解決方案
①更新mysql驅(qū)動(dòng)的jar版本,修改為8.0.11版本
<!-- https://mvnrepository.com/artifact/mysql/mysql-connector-java -->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>8.0.11</version>
</dependency>
②修改數(shù)據(jù)庫(kù)配置driver為com.mysql.cj.jdbc.Driver(可以不改),url加上serverTimezone=UTC(這兩個(gè)是8.x與5.x不同的配置)文章來源:http://www.zghlxwxcb.cn/news/detail-812384.html
文章來源地址http://www.zghlxwxcb.cn/news/detail-812384.html
到了這里,關(guān)于java.sql.SQLException: Unable to load authentication plugin ‘caching_sha2_password‘解決的文章就介紹完了。如果您還想了解更多內(nèi)容,請(qǐng)?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!