我试图使用MySQL数据库(我的电脑上已安装的虚拟机(Debian的),并且具有IP地址192.168.1.5
),从Java与使用NetBeans。
我已经配置了连接,如下所示:
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
然后我得到以下错误:
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.)
我mysql.user
表看起来像这样(我知道% root
不是很安全的,但是这仅仅是为了简化事情暂时):
+------------+------------------+
| host | user |
+------------+------------------+
| % | root |
| 127.0.0.1 | root |
| ::1 | root |
| debVirtual | |
| localhost | |
| localhost | debian-sys-maint |
| localhost | phpmyadmin |
| localhost | root |
+------------+------------------+
我能做些什么,使这个连接?