【问题标题】:Connection Spring Boot-MySql : Public Key Retrieval is not allowed连接 Spring Boot-MySql:不允许检索公钥
【发布时间】:2019-12-16 09:37:48
【问题描述】:

我在今年 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

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

【问题讨论】:

  • 查看这个帖子https://stackoverflow.com/questions/50379839/connection-java-mysql-public-key-retrieval-is-not-allowed
  • 谢谢。我尝试添加useSSL=false&allowPublicKeyRetrieval=true,但仍然无法解决问题。

标签: java mysql spring


【解决方案1】:

可能的解决方案:

1 - 检查 mysql 是否使用端口 3306 并且它是活动的。

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

3 - 如果您使用的是 Mysql 8 及更高版本,则可以查看身份验证插件更改表单this link

【讨论】:

    【解决方案2】:

    使用下面的

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

    【讨论】:

      猜你喜欢
      • 2018-10-27
      • 2019-07-01
      • 2014-05-28
      • 1970-01-01
      • 2017-11-13
      • 2015-07-22
      • 2020-05-29
      • 2021-03-20
      • 1970-01-01
      相关资源
      最近更新 更多