In a Java application I'm programming, when I ask the program to retrieve data from an SQL database, it shows this in console :
Wed Apr 20 16:57:58 MDT 2016 WARN: Establishing SSL connection without server's identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification.
I know that's a lot to read, and I have SSL disabled in the SQL workbench, so I can't figure out how to get rid of the warning or if I should even be concerned about it? Thanks in advance.
You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification. If you want to avoid the above MySQL warning, use the syntax mention in the beginning.
Disabling SSL in MySQL If your requirement is to completely turn off SSL on MySQL server instead of the default option of 'enabled, but optional mode', we can do the following: Delete the *. pem certificate and key files in the MySQL data directory. Start MySQL with SSL option turned off.
mysql/workbench/connections. xml , look for the connection that you want to disable ssl, and find <value type="int" key="useSSL">2</value> set it to 0, that will disable ssl for that connection.
5 and earlier, in which case the client must set the connection property useSSL=true in order to use encrypted connections). The client can demand SSL to be used by setting the connection property requireSSL=true ; the connection then fails if the server is not configured to use SSL.
Try to use the useSSL=false in the connection string
Example:
jdbc:mysql://xxxxxxx:3306/xxxx?autoReconnect=true&useSSL=false
EDIT:
I had issue today 11/20/2019 while connecting mysql version 8.0.12 using java mysql driver (com.mysql.cj.jdbc.Driver, 8.0.18) and got following error
Exception in thread "main" java.sql.SQLNonTransientConnectionException: Public Key Retrieval is not allowed
I had to add allowPublicKeyRetrieval=true
to connection string to fix the connection issue.
Updated this answer because its related issue :)
Replace – jdbc:mysql://localhost:3306/demo
With – jdbc:mysql://localhost:3306/demo?useSSL=false
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