Java 连接Spring Boot MySql:不允许检索公钥
我在今年6月初运行了一个应用程序,没有出现任何问题。今天再次尝试后,控制台中出现以下错误:Java 连接Spring Boot MySql:不允许检索公钥,java,mysql,spring,Java,Mysql,Spring,我在今年6月初运行了一个应用程序,没有出现任何问题。今天再次尝试后,控制台中出现以下错误: com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException:不允许检索公钥 有没有关于如何修复的想法 我对此进行了研究,但没有发现任何特定于Spring Boot应用程序的东西 applications.properties中的设置: spring.mvc.view.prefix=/WEB-INF/views/ spring.
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:不允许检索公钥
可能的解决方案:
1-检查mysql是否使用端口3306并且它是活动的
2-确保您的mysql用户名和密码正确
3-如果您使用的是Mysql 8及以上版本,那么您可以检查身份验证插件更改表,使用以下命令
jdbc:mysql://localhost:3306/payphone?useSSL=false&useJDBCComplaintTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=UTC&allowPublicKeyRetrieval=true
检查此线程
https://stackoverflow.com/questions/50379839/connection-java-mysql-public-key-retrieval-is-not-allowed
谢谢。我尝试添加usesl=false&allowPublicKeyRetrieval=true
,但仍然无法解决问题。