WARN: Establishing SSL connection without server's identity verification is not recommended

In this post, I will provide a solution for this warning message:
WARN: Establishing SSL connection without the server's identity verification is not recommended

Problem

To reproduce this warning, just start a Spring Boot application and making a JDBC connection, hits the following warning messages on the console :
Tue Aug 20 15:50:24 IST 2019 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.
19-08-20 Tue 15:50:24.570 INFO  HikariDataSource HikariPool-1 - Start completed.
Here are the connection properties in application.properties:
spring.datasource.url=jdbc:mysql://localhost:3306/springboot_demo
spring.datasource.username=root
spring.datasource.password=root

spring.jpa.hibernate.ddl-auto=update
spring.jpa.database-platform=org.hibernate.dialect.MySQL57Dialect

logging.level.org.hibernate.SQL=DEBUG
logging.level.org.hibernate.type=TRACE

Solution

To fix it, append a useSSL=false at the end of the MySQL connection string :
spring.datasource.url=jdbc:mysql://localhost:3306/springboot_demo?useSSL=false
spring.datasource.username=root
spring.datasource.password=root

spring.jpa.hibernate.ddl-auto=update
spring.jpa.database-platform=org.hibernate.dialect.MySQL57Dialect

logging.level.org.hibernate.SQL=DEBUG
logging.level.org.hibernate.type=TRACE
useSSL=false - This will disable SSL and also suppress the SSL errors.

Reference


Comments