We Are Going To Discuss About Connection Java – MySQL : Public Key Retrieval is not allowed. So lets Start this Java Article.
Connection Java – MySQL : Public Key Retrieval is not allowed
- Connection Java – MySQL : Public Key Retrieval is not allowed
Right click your connection, choose “Edit Connection”
On the “Connection settings” screen (main screen) click on “Edit Driver Settings”
Click on “Connection properties”
Right click the “user properties” area and choose “Add new property” - Connection Java – MySQL : Public Key Retrieval is not allowed
Right click your connection, choose “Edit Connection”
On the “Connection settings” screen (main screen) click on “Edit Driver Settings”
Click on “Connection properties”
Right click the “user properties” area and choose “Add new property”
Solution 1
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
Original Author jtomaszk Of This Content
Solution 2
For DBeaver users:
-
Right click your connection, choose “Edit Connection”
-
On the “Connection settings” screen (main screen) click on “Edit Driver Settings”
-
Click on “Connection properties”
-
Right click the “user properties” area and choose “Add new property”
-
Add two properties: “useSSL” and “allowPublicKeyRetrieval”
-
Set their values to “false” and “true” by double clicking on the “value” column
Original Author Javier Aviles Of This Content
Solution 3
When doing this from DBeaver I had to go to “Connection settings” -> “SSL” tab and then :
- uncheck the “Verify server certificate”
- check the “Allow public key retrival”
Note that this is suitable for local development only.
Original Author Michał Krzywański Of This Content
Solution 4
Use jdbc url
as :
jdbc:mysql://localhost:3306/Database_dbName?allowPublicKeyRetrieval=true&useSSL=False;
PortNo: 3306
can be different in your configuation
Original Author susan097 Of This Content
Conclusion
So This is all About This Tutorial. Hope This Tutorial Helped You. Thank You.