Can't connect to MySQL database if I use IP instead of "localhost" in the connection URL
Posted by:
Hol Demgun
Date: August 30, 2023 03:23AM
I utilize the `com.mysql.cj.jdbc.Driver` connector. Initially, I encountered difficulties in establishing a connection to `jdbc:mysql://localhost:3306/my_db` until I appended `bind-address="127.0.0.1"` to the MySQL configuration file, my.ini.
I got this error message:
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.
Now, moving on to a question that might sound a bit basic:
My computer is connected to the internet via a WiFi router that serves multiple devices. Is it feasible for a MySQL Server, reachable from the internet, to be hosted through this WiFi router? Could this potentially be the root of the issue?
I unsuccessfully tried to change bind-address in my.ini to the IP.
Subject
Written By
Posted
Can't connect to MySQL database if I use IP instead of "localhost" in the connection URL
August 30, 2023 03:23AM
September 07, 2023 12:53PM
Sorry, you can't reply to this topic. It has been closed.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion
of Oracle or any other party.