I’m encountering a communication issue with my MySQL database and I would appreciate your help in resolving it. When I try to establish a connection with the database, I’m getting the following error:
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.
Here’s the configuration of my data source in my application:
spring.datasource.url=jdbc:mysql://localhost:3306/test?createDatabaseIfNotExist=true&serverTimezone=UTC
spring.datasource.username=root
spring.jpa.hibernate.ddl-auto=update
spring.jpa.generate-ddl=true
spring.jpa.show-sql=true
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQL5Dialect
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
I should also mention that I’ve tested the connection locally, and it works perfectly fine. The issue seems to arise only when deploying the application to the server environment
I’m relatively new to this, so it’s entirely possible that I’ve overlooked something crucial. Any guidance or suggestions, especially considering my beginner status, would be immensely helpful in resolving this issue
Thank you in advance for your assistance!
Sonia is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.