在连接Linux上的mysql时出现
Communications link failure due to underlying exception
...
Last packet sent to the server was 1 ms ago
...
这个是由于数据库连接超时造成的。需要修改mysql配置
打开
vi /etc/my.cnf
找到
wait_timeout = 30
30是默认超时时间,单位是秒
将30改为10年 315360000
wait_timeout = 315360000
然后重启mysql服务
service mysqld restart
再试是否还有超时