<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<scope>runtime</scope>
<version>8.0.21</version>
</dependency>
原因:mysql-connector的版本不对,我之前是4x,旧版本不支持sha,替换为新版本即可,我替换为了8.0.21,对应的加密方式不同。 native 和sha2
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<scope>runtime</scope>
<version>8.0.21</version>
</dependency>
原因:mysql-connector的版本不对,我之前是4x,旧版本不支持sha,替换为新版本即可,我替换为了8.0.21,对应的加密方式不同。 native 和sha2