连接 Spring Boot-MySql:不允许公钥检索

wal*_*ker 4 java mysql spring

我在今年 6 月初运行了我的一个应用程序,没有出现任何问题。今天再次尝试后,我在控制台中收到以下错误:

com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: Public Key Retrieval is not allowed

关于如何修复的任何想法?

我对此进行了研究,但没有发现任何特定于 Spring Boot 应用程序的内容。

Applications.properties 中的设置:

spring.mvc.view.prefix=/WEB-INF/views/

spring.mvc.view.suffix=.jsp

spring.datasource.url = jdbc:mysql://localhost:3306/testdb?verifyServerCertificate=false&useSSL=false&requireSSL=false&useJDBCCompliantTimezoneShift=true&serverTimezone=UTC
spring.datasource.username = root
spring.datasource.password = 


spring.jpa.show-sql = true 


spring.jpa.generate-ddl=true
spring.jpa.hibernate.ddl-auto = update


spring.jpa.hibernate.naming.implicit-strategy = org.hibernate.cfg.ImprovedNamingStrategy

spring.jpa.properties.hibernate.dialect = org.hibernate.dialect.MySQL5InnoDBDialect
Run Code Online (Sandbox Code Playgroud)

com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: Public Key Retrieval is not allowed

小智 8

使用以下

jdbc:mysql://localhost:3306/payphone?useSSL=false&useJDBCComplaintTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=UTC&allowPublicKeyRetrieval=true
Run Code Online (Sandbox Code Playgroud)


小智 4

可能的解决方案 :

1 - 检查 mysql 是否使用端口 3306 并且它是否处于活动状态。

2 - 确保您的 mysql 用户名和密码正确。

3 - 如果您使用的是 Mysql 8 及更高版本,那么您可以从此链接检查身份验证插件更改