I am trying to use a MySQL database (which is installed on a virtual machine (Debian) on my computer and has an IP address 192.168.1.5) with Java using NetBeans.
I configured the connection as follows:
Driver Name MySQL(Connector/J Driver)
Host 192.168.1.5
Database test
Username root
Password *
JDBC URL jdbc:mysql://192.168.1.5:3306/test
and then I get the following error:
cannot establish a connection to jdbc:mysql://192.168.1.5:3306/test using
com.mysql.jdbc.Driver (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.)
My table mysql.userlooks like this (I know that it is % rootnot very safe, but this is just for simplification at the moment):
+------------+------------------+
| host | user |
+------------+------------------+
| % | root |
| 127.0.0.1 | root |
| ::1 | root |
| debVirtual | |
| localhost | |
| localhost | debian-sys-maint |
| localhost | phpmyadmin |
| localhost | root |
+------------+------------------+
What can I do to allow this connection?
source
share