Connection Java - Mysql:Public Key Retrieval Is Not Allowed

Connection Java - MySQL : Public Key Retrieval is not allowed

You should add client option to your mysql-connector allowPublicKeyRetrieval=true to allow the client to automatically request the public key from the server. Note that allowPublicKeyRetrieval=True could allow a malicious proxy to perform a MITM attack to get the plaintext password, so it is False by default and must be explicitly enabled.

https://mysql-net.github.io/MySqlConnector/connection-options/

you could also try adding useSSL=false when you use it for testing/develop purposes

example:

jdbc:mysql://localhost:3306/db?allowPublicKeyRetrieval=true&useSSL=false

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

So i deleted the total web project an created a new one and it seems to be working fine now with this url="jdbc:mysql://localhost:3306/web_student_tracker?useSSL=false"

Connection between DBeaver & MySQL

Did you try explicitly allowing public key retrieval in DBeaver?
In the connection settings, SSL tab you can find it

enter image description here

This is in case you are using SSL, otherwise in the same screen you can disable SSL by unchecking "use SSL" and "require SSL"

Spring Boot unable to connect to MySQL Server without prior connexion with MySQL Work Bench

I have added allowPublicKeyRetrieval=true to spring.datasource.url.

Now the Spring Boot app connects to the database also before I have done the connection using MySQL WorkBench.



Related Topics



Leave a reply



Submit