MySQL数据库提示:Communications link failure,The last packet succe
Last modified:2013-10-08 14:16:47
**********************************************
web网站使用MySQL数据库,今天突然报以下错误:
Communications link failure,The last packet successfully received from the server was *** millisecond ago.The last packet successfully sent to the server was *** millisecond ago。
原因:
Mysql服务器默认的“wait_timeout”是8小时(也就是默认的值默认是28800秒),也就是说一个connection空闲超过8个小时,Mysql将自动断开该connection,通俗的讲就是一个连接在8小时内没有活动,就会自动断开该连接。而连接池却认为该连接还是有效的(因为并未校验连接的有效性),当应用申请使用该连接时,就会导致上面的报错。
wait timeout的值可以设定,但最多只能是2147483,不能再大了。也就是约24.85天。
修改方法:MySQL通过my.ini 在
# The TCP/IP Port the MySQL Server will listen on
port=3306下面添加
# this is myown dinifition for mysql connection timeout
wait_timeout=31536000
interactive_timeout=31536000
以上是在网上找到的解决方法,但是一般连接的有效时间不用修改,后来分析了以下问题,发现是由于数据库连接池的一句配置引发的:
Xml代码
<!-- 最大空闲时间,60秒内未使用则连接被丢弃。若为0则永不丢弃。Default: 0 -->
<property name="maxIdleTime" value="0"></property>
由于mysql的连接空闲超过8个小时,所以就关闭了,但是连接池却永不丢弃连接,认为该连接还是有效的(因为并未校验连接的有效性),当应用申请使用该连接时,就会导致上面的报错。
解决方法将value设置为20。
MySQL数据库提示:Communications link failure,The last packet succe相关推荐
- IDEA连接MySQL失败-[08S01] Communications link failure
一.问题现状描述 使用IDEA启动maven项目,报错连接MySQL数据库失败,尝试用IDEA的database插件,连接本地MySQL库(Windows10本机搭建) 报错结果如下: [08S01] ...
- Mysql异常之Communications link failure
前天线上出现数据数据抖动,收到大量异常告警,都要疯了,数据库出现大量异常,肯定第一件事就是看下数据库监控数据,发现有一个从分片执行时间有一个50多秒的操作,这里肯定有问题了,第一时间找了dba,经过排 ...
- MySQL : mysql连接报 Communications link failure
1.美图 2.背景 一个项目原本能跑,今天突然连不上了. 第一种:MySQL数据服务没有开启导致连接失败 第二种:MySQL数据库设置成了外网不能访问,需要开启外网IP访问的功能. 第三种:可能是网络 ...
- Underlying cause: com.mysql.cj.jdbc.exceptions.CommunicationsException : Communications link failure
Hive试图schematool -dbType mysql -initSchema时候报错如下: Metastore connection URL: jdbc:mysql://Desktop ...
- 问题记录——com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure...
最近在搞一个Spring boot + Mybatis + Mysql的项目,用Mybatis访问数据库时,报了如下的错误,先在网上搜索了,试了各种办法都不行, 奇葩的是,连接另外1个数据库又没问题. ...
- KettleError connecting to database: (using class org.gjt.mm.mysql.Driver)Communications link failure
先看错误: 错误连接数据库 [JDOrd] : org.pentaho.di.core.exception.KettleDatabaseException: Error occurred while ...
- 【数据库问题】[08S01] Communications link failure
[08S01] Communications link failure The last packet sent successfully to the server was 0 millisecon ...
- Connection timed out: connect; Communications link failure
今天过来启动自己的项目出现如下的问题: Communications link failure The last packet sent successfully to the server was ...
- Rejecting re-init Communications link failure
@[TOC](Rejecting re-init on previously-failed class java.lang.Class<com.mysql.cj.MysqlType>: j ...
- Communications link failure解决
启动程序时报错Communications link failure The last packet sent successfully to the server was 0 millisecond ...
最新文章
- pip install 安装报错:UnicodeEncodeError: 'ascii' codec can't encode characters in position XX的解决办法...
- Linux下安装FFmpeg
- stm32 adc 连续和扫描_技术分享 | STM32多个ADC模块同时采样转换的应用示例
- python中与label类似的控件是_python中tkinter的使用(控件整理)(一)
- android studio列模式,在Android studio 中使用单例模式
- mysql error1045 yes_MYSQL ERROR 1045 (28000): Access denied for user (using password: YES)问题的解决...
- 封杀抖音,微博在紧张什么?
- cvsaveimage 异常_C++ IplImage*的若干bug之三:cvSaveImage問題
- 每日一题_JavaScript.利用Js操作frameset框架集对象实现购物车?
- 项目经理排期的几个tip
- 马云的经典语录(转载)
- 关于rstudio的一些快捷键
- 刷新报表页面的方法总结
- grep有时抓不到文本怎么办?
- 2021年T电梯修理免费试题及T电梯修理试题及解析
- 扩展Windows 7内存 巧用ReadyBoost提速
- MongoDB 极简实践入门
- 关于JPEG、PNG、GIF、WEBP图片格式的理解与使用场景
- linux解压rar文件出错,Linux下安装rar解压缩文件的方法和所遇到的问题解决方法...
- 关于BCM61650IFB1G
热门文章
- 微型计算机的运算器控制器及内存储器统称为,微型计算机的运算器控制器及内存储器统称为...
- Android App监听软键盘按键的三种方式 以及 输入法删除退格键的冲突问题解决
- uniapp运行到小程序之无法启动
- SOLIDWORKS仿真攻略丨非线性静态分析之卡扣分析
- 网工如何巧妙找到好工作?
- Axis2 webservice学习总结
- 图书管理系统可行性分析报告
- only whitespace content allowed before start tag and not
- iOS--正则表达式
- 【翻译】Sencha现状 ———采访Atanas Popov