Just to tell you My Machine is Windows 10 pro.
Spring boot codebase running on my local eclipse.
And I have Docker Desktop installed in my System where I have created Mysql container.
Following error comes when I Run as Spring Boot App:
2020-05-23 20:28:02.279 INFO 76 --- [ main] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Starting...
2020-05-23 20:28:24.354 ERROR 76 --- [ main] com.zaxxer.hikari.pool.HikariPool : HikariPool-1 - Exception during pool initialization.
com.mysql.cj.jdbc.exceptions.CommunicationsException: Communications link failure
The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
at com.mysql.cj.jdbc.exceptions.SQLError.createCommunicationsException(SQLError.java:174) ~[mysql-connector-java-8.0.16.jar:8.0.16]
at com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:64) ~[mysql-connector-java-8.0.16.jar:8.0.16]
I ran to the same situation. The root cause is MySQL Server and Clients are running in two different versions. Thats the reason you are seeing handshake connection issue because of mysql protocol version mismatch.
Run you server with most recent version that should solve the problem.
Hi friend,
I tried all the three option of jdbc url, but did not work. Request your help.
spring.datasource.url=jdbc:mysql://localhost:3306/hello_java
spring.datasource.url=jdbc:mysql://:3306/hello_java
spring.datasource.url=jdbc:mysql://:3306/hello_java
Just to tell you My Machine is Windows 10 pro.
Spring boot codebase running on my local eclipse.
And I have Docker Desktop installed in my System where I have created Mysql container.
Following error comes when I Run as Spring Boot App:
2020-05-23 20:28:02.279 INFO 76 --- [ main] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Starting...
2020-05-23 20:28:24.354 ERROR 76 --- [ main] com.zaxxer.hikari.pool.HikariPool : HikariPool-1 - Exception during pool initialization.
com.mysql.cj.jdbc.exceptions.CommunicationsException: Communications link failure
The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
at com.mysql.cj.jdbc.exceptions.SQLError.createCommunicationsException(SQLError.java:174) ~[mysql-connector-java-8.0.16.jar:8.0.16]
at com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:64) ~[mysql-connector-java-8.0.16.jar:8.0.16]
I ran to the same situation. The root cause is MySQL Server and Clients are running in two different versions. Thats the reason you are seeing handshake connection issue because of mysql protocol version mismatch.
Run you server with most recent version that should solve the problem.
docker run --name mysql57 -p 3306:3306 \
-e MYSQL_ROOT_PASSWORD=1234 \
-e MYSQL_USER=demo_java \
-e MYSQL_PASSWORD=1234 \
-e MYSQL_DATABASE=hello_java \
-d mysql/mysql-server
or Specify the compatible JDBC driver version in pom.xml