Spring Boot连接MySql时出现Public Key Retrieval is not allowed错误。

7

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

com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: 公钥检索不允许

有什么解决方法吗?

我已经进行了研究,但没有找到与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

com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: 不允许检索公钥

涉及 IT 技术相关内容。

请查看此线程: https://dev59.com/VFUL5IYBdhLWcg3waXcr - Doctor Who
2
谢谢。我尝试添加 useSSL=false&allowPublicKeyRetrieval=true 但仍然无法解决问题。 - wallwalker
2个回答

13

请使用以下内容

jdbc:mysql://localhost:3306/payphone?useSSL=false&useJDBCComplaintTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=UTC&allowPublicKeyRetrieval=true

4
可能的解决方案:

1 - 检查mysql是否使用3306端口并且处于运行状态。

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

3 - 如果您正在使用Mysql 8及以上版本,则可以通过此链接检查身份验证插件的更改。


这里的步骤 https://qiita.com/moonlightbox/items/5fe3d5df691b4ec53084 解决了我的问题。我正在使用docker中的mysql 8。谢谢。 - Mwesigye John Bosco

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接