7

I ran one of my apps back in early June of this year with no problems. After trying it again today, I get the following error in the console :

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

Any ideas on how to fix?

I've researched this but have found nothing specific to Spring Boot apps.

Settings in 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

wallwalker
  • 591
  • 7
  • 14
  • 27
  • check this thread `https://stackoverflow.com/questions/50379839/connection-java-mysql-public-key-retrieval-is-not-allowed` – Doctor Who Aug 08 '19 at 16:20
  • 2
    Thanks. I tried adding `useSSL=false&allowPublicKeyRetrieval=true` but still does not resolve the issue. – wallwalker Aug 08 '19 at 16:36

2 Answers2

13

use the following

jdbc:mysql://localhost:3306/payphone?useSSL=false&useJDBCComplaintTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=UTC&allowPublicKeyRetrieval=true
Abhishek Bhagate
  • 5,583
  • 3
  • 15
  • 32
Sheriff Adebisi
  • 131
  • 1
  • 2
4

Possible solutions :

1 - Check if the mysql uses port 3306 and it's alive.

2 - Make sure your mysql username and password is correct.

3 - If you are using Mysql 8 and above then you may check authentication plugin change form this link

lutfucan
  • 151
  • 3
  • 12