mysql-错误:com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure
来源:互联网 发布:迪杰斯特拉算法应用 编辑:程序博客网 时间:2024/06/02 20:38
系统登陆功能隔段时间就会发神经,点击登录没反应,状态码返回:500。开始以为是代码问题,后来查看日志发现以
下错误:
com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure
com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure Last packet sent to the server was 0 ms ago
通过mysql客户端命令查看:show global variables like 'wait_timeout';
显示为28000=8*3600,也就是说mysql默认的连接维持时间是8个小时,前一天晚上回去,到第二天过来,已经超过了8个小时,程序已经与mysql失去了连接,所以报错。
解决办法:
因为wait_timeout的最大值分别是24天/365天(windows/linux),所以我们可以修改超时的最大值。
programData文件夹下找到mysql目录中的my.ini文件,添加如下:
wait_timeout=2073600interactive_timeout=2073600
1 1
- com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure
- 解决com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure
- com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure
- 解决com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure
- com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure
- com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure
- com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure
- com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure
- com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure
- com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure 解决办法
- com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure
- com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure
- com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure
- com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure
- com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure
- Cause: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure
- com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure
- com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure
- Yii modules中layout的调用
- 开启错误提示_PHP和Apache的设置方法
- Ubuntu上安装 LAPACK3.5.0
- oracle 列转行
- PMBOK 学习笔记2-组织的影响
- mysql-错误:com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure
- CSS3 经典教程系列:CSS3 线性渐变(linear-gradient)
- caffe的数据集的data和label制作原则
- tinyxml使用
- Win7 + vs2012 + cocos2d-x2.2.5 配置开发环境
- java 线程wait()与notify()的用法(被唤醒后的线程到底重新执行同步代码块还是从那是等待的那里继续执行)
- Libevent基本应用实例--专为懒人定制
- 【d3.js实践教程01】d3基本操作
- Linux SSH