The last packet sent successfully to the server was 0 milliseconds ago

来源:互联网 发布:钱咖淘宝返利是真的吗 编辑:程序博客网 时间:2024/06/05 16:46

java连接mysql数据库的时候,提示:

The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server. 


解决方法:

(1)

检查url地址是否正确,ip地址要写成127.0.0.1或者写成localhost,端口号为3306。

(2)

修改mysql的配置参数

$sudo vim /etc/mysql/my.cnf

添加以下内容

[mysqld]

wait_timeout=31536000

intercative_timeout=31536000

(3)重启mysql

$service mysql restart


0 0