Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/mysql/68.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 连接Spring Boot MySql:不允许检索公钥_Java_Mysql_Spring - Fatal编程技术网

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

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.

我在今年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:不允许检索公钥

可能的解决方案:

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
,但仍然无法解决问题。