出现这种错误的大致情况如下:

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的更多相关文章

  1. 【错误】: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 ...

  2. 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 ...

  3. The last packet successfully received from the server was 1,480 milliseconds ago.

    场景:一个上传接口,需要上传几十M的文件,文件中包含10几W的数据,然后对10+W的数据进行同步批量插入,每次批量插入1W.最后返回结果. 项目上线一段时间后,上传接口出现问题,数据库用的MySQL5 ...

  4. Communications link failure,The last packet successfully received from the server was *** millisecon

    使用Connector/J连接MySQL数据库,程序运行较长时间后就会报以下错误: Communications link failure,The last packet successfully r ...

  5. 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 ...

  6. 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 ...

  7. 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 ...

  8. 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 ...

  9. 【异常】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 ...

  10. Cannot create PoolableConnectionFactory (Communications link failure The last packet sent successfu

    SQL: Cannot create JDBC driver of class '' for connect URL 使用数据库数据源的web 项目,发布后,访问数据库500报错: 浏览器端: 控制台 ...

随机推荐

  1. System.Diagnostics.Process.Start(); 用法详解

    来源:https://news.68idc.cn/buildlang/ask/20150104156981.html 实例代码:http://www.cppcns.com/ruanjian/cshar ...

  2. ASR6601:国产化lora SOC芯片兼容SX1262/SX1268

    ASR6601为目前首颗国产化支持LoRaWAN低功耗广域网无线通信SoC芯片.ASR6601在单芯片上集成了通用微控制器和射频单元(SX1262),包括射频收发器,调制解调器和48 MHz 主频.A ...

  3. stl仿函数集合

  4. eval()

    s='12*2'd=eval(s)#字符串运算函数print(d) 结果: 24

  5. webpack和source map

    当 webpack 打包源代码时,可能会很难追踪到 error(错误) 和 warning(警告) 在源代码中的原始位置. 如果打包后代码有一处错误,特别是使用的vue.react这些前端框架.打包后 ...

  6. tidb 杂记

    tidb_biuil_stats_concurrency 执行analyze table时会分成多个小任务,可以同时执行的任务数量.tidb_distsql_scan_concurrency 在执行分 ...

  7. C#判断窗体是否打开,并获取聚焦、未打开则新建一个子窗体

    在桌面程序开发会遇到的情况,托盘功能或者是小功能弹窗问题: 现有一个主窗体有子窗体 子窗体每个都可以新建其他窗体问题:新建子窗体时怎么判断子窗体是否打开?若子窗体打开则置顶获取焦点.若未打开则新建一个 ...

  8. sqoop,hive2mysql

    sqoop export \ --connect jdbc:mysql://master:3306/testdb \ --username hive \ --password 123456 \ --t ...

  9. ubuntu22.04LTS下编译glfw

    环境准备 # 预装cmake sudo apt install cmake # 下载源码 git clone https://github.com/glfw/glfw.git 编译 # cmake初始 ...

  10. Kubernetes学习笔记(一)

    参考: kubectl Cheat Sheet | Kubernetes Kubernetes kubectl 命令表 _ Kubernetes(K8S)中文文档_Kubernetes中文社区 Pla ...