mysql连接异常通信链接失败

时间:2016-11-07 06:46:28

标签: java mysql database-connection

这有点问题。我有两个服务器A和B,并且mysql安装在服务器A上,然后使用mysql>grant all privileges on dbname.* to user1@BserverIP identified by 'pass';flush privileges;为B授予权限,而从B,我可以使用命令mysql -h B -u xx -p'xx'连接到服务器上的mysql。但是从项目视图来看,错误错误:

com.mysql.jdbc.exceptions.jdbc4.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.
    sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)

在项目属性文件中,配置如下:

url=jdbc:mysql://B server ip:3306/dbname
username=user1
password=pass

所以有人可以帮忙吗?

0 个答案:

没有答案