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

xiaoxiao2021-02-27  185

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

转载请注明原文地址: https://www.6miu.com/read-12311.html

最新回复(0)