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
Update MySQL JDBC Driver Version I think the best way to fix the error “Public Key Retrieval is not allowed” is updating the version of my-sql-connector-java to the version compatible with the version of MySQL server. For example, if your MySQL server version is 8.0.
We need to set AllowPublicKeyRetrieval=true to allow the client to automatically request the public key from the server. allowPublicKeyRetrieval=true. You can also disable SSL and also suppress the SSL errors: useSSL=false.
use the following
jdbc:mysql://localhost:3306/payphone?useSSL=false&useJDBCComplaintTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=UTC&allowPublicKeyRetrieval=true
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With