Communications link failure:The last packet successfully received from the server was 0 millisecond ago
出现这种错误的大致情况如下:
1、数据库连接长时间未使用,断开连接后,再去连接出现这种情况。这种情况常见于用连接池连接数据库出现的问题
2、数据库连接的后缀参数问题
针对上述两种情况,解决方案如下
1、修改MySQL的参数,my.cnf位于/etc目录下,修改完成后,重启mysql
wait_timeout最大为31536000即1年,在my.cnf中加入:
[mysqld]
wait_timeout=31536000
interactive_timeout=31536000
2、连接数据库的时候参数问题
如果使用mysql版本为5.7+,驱动Driver使用的是:com.msyql.cj.jdbc.Driver
那么你必须在连接url后面添加
useSSL=false
3、直接修改mysql的参数,不用重启
进入mysql的命令行或者客户端
show global variables like '%wait_timeout%';
将wait_timeout 和interactive_timeout 设置的大一点。默认是8小时(28800)。
set global wait_timeout=604800;
set global interactive_timeout=604800;
刷新缓存
flush privileges;
Communications link failure:The last packet successfully received from the server was 0 millisecond ago的更多相关文章
- 【错误】:Could not open JDBC Connection for transaction; nested exception is: Communications link failure;The last packet sent successfully to the server was 1 milliseconds ago
# #错误日志 2016-11-10 16:19:20,834 ERROR [org.quartz.core.JobRunShell] - Job DEFAULT.jobtask threw an u ...
- The last packet successfully received from the server was 20,519 milliseconds ago. The last packet sent successfully to the server was 0 milliseconds ago.
本地升级了下MySQL的版本,从5.6升为5.7,数据文件直接拷贝的,项目查询数据库报错: Could not retrieve transation read-only status server ...
- The last packet successfully received from the server was 1,480 milliseconds ago.
场景:一个上传接口,需要上传几十M的文件,文件中包含10几W的数据,然后对10+W的数据进行同步批量插入,每次批量插入1W.最后返回结果. 项目上线一段时间后,上传接口出现问题,数据库用的MySQL5 ...
- Communications link failure,The last packet successfully received from the server was *** millisecon
使用Connector/J连接MySQL数据库,程序运行较长时间后就会报以下错误: Communications link failure,The last packet successfully r ...
- org.apache.ibatis.exceptions.PersistenceException: ### Error querying database. Cause: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure The last packet sent succ
数据库 没有开启 连接失败 org.apache.ibatis.exceptions.PersistenceException: ### Error querying database. Cause ...
- The last packet successfully received from the server was 2,926,157 milliseconds ago. The last packet sent successfully to the server was 2,926,158 milliseconds ago. is longer than the server configured value of 'wait_timeout'. 解决办法
Caused by: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: The last packet successfully rec ...
- Cause: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: The last packet successfully received from the server was 78,050,512 milliseconds ago.
今天访问已经架上服务器的网站,报错: Cause: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: The last packet s ...
- Mysql 的异常:The last packet successfully received from the server was 90 milliseconds ago. The last packet sent successfully to the server was 43,603,303 milliseconds ago. is longer than the server con
调试一个程序, 调试到一半, 下班回家, 程序卡在了某一行, 第二天早上回来一看, 发现了异常: Wed Sep :: GMT+: WARN: Establishing SSL connection ...
- 【异常】ser class threw exception: java.sql.SQLException: The last packet successfully received from the server was 39,444 milliseconds ago. The last
1 详细异常 ser class threw exception: java.sql.SQLException: The last packet successfully received from ...
- Cannot create PoolableConnectionFactory (Communications link failure The last packet sent successfu
SQL: Cannot create JDBC driver of class '' for connect URL 使用数据库数据源的web 项目,发布后,访问数据库500报错: 浏览器端: 控制台 ...
随机推荐
- 使用layui实现分页展示数据库的数据
layui是一个前端 UI 框架,内置了js代码,所以我们可以直接使用内置的分页 首先要用到layui的官网手册https://www.layui.com/ 1.进入手册页面的 "示例&qu ...
- python 提取文件的名字 和路径
# coding=utf-8 import sys import os s = 'C:/Users/Desktop/lesson/python/calss1.py' m_dir = os.path.d ...
- go 语言的宕机恢复(recover)
go 语言中的三种报错机制 第一种,也就是常说的 error 类型错误,不需要 recover 拯救,处理方式自己决定 第二种,panic 和 recover 是紧密集合的,有点类似 try catc ...
- CMake配置跨平台项目踩的坑
当要在windows平台下使用MinGW作为cmake使用的make平台时,需要确保cmake能够在系统环境变量PATH中找到MinGW的bin目录,如果PATH中没有MinGW的话可以在CMakeL ...
- win/ubuntu/centos 安装后台监控工具btop
之前linux平台进行后台监控一直是简单的看top,但界面太难看而且需要记的缩写太多而且不直观(对于我来说),后面有尝试替换htop,扩展支持了鼠标操作以及直观监控,但是界面还是难看,今天查找了一下发 ...
- matlab画图之plot画折线图
Matlab绘制折线图 使用plot(x,y)函数创建折线图时,x,y有以下要求: ①如果 X 和 Y 都是向量,则它们的长度必须相同.plot 函数绘制 Y 对 X 的图. ②如果 X 和 Y 均为 ...
- Vulnhub 靶场 DIGITALWORLD.LOCAL: SNAKEOIL
Vulnhub 靶场 DIGITALWORLD.LOCAL: SNAKEOIL 前期准备 靶机地址:https://www.vulnhub.com/entry/digitalworldlocal-sn ...
- Jquery 如何替换html字符串中标签属性值 ??
如何利用JQuery 替换HTML字符串中的属性值呢? 如 html 字符串有很多 img标签,现在需要修改 img的src值 var html="<div style="t ...
- 解决django中的跨域问题
解决django中的跨域问题: Django项目中出现跨域问题,用第三方包django-cors-headers来解决跨域问题. 安装:pip install django-cors-headers; ...
- pip备份、安装requirements.txt中的包和anaconda的安装(linux)
pip备份.安装requirements.txt中的包和anaconda的安装(linux) 1. 从已有的环境中,备份已经安装的package pip freeze > requireme ...