xampp错误: mysql 非正常关闭._mysql数据库常见报错之Timeout reading communication packets...

概述

在观察某个数据库错误日志的时候发现一直在刷错误信息:

2019-09-20T07:41:17.933680Z 1936 [Note] Aborted connection 1936 to db: 'test' user: 'fsl' host: 'xxxx' (Got timeout reading communication packets)
198ecbfd2a04df47f40c87389b2bb286.png

这个问题还是比较常见的,下面简单记录一下解决过程。


思路

可能导致Got Timeout reading communication packets错误的原因有如下几个:

  • A client attempts to access a database but has no privileges for it.(没有权限)
  • A client uses an incorrect password.(密码错误)
  • A connection packet does not contain the right information.(连接没有包含正确信息)
  • It takes more than connect_timeout seconds to obtain a connect packet. (获取连接信息起过connect_timeout的时长)
  • The client program did not call mysql_close() before exiting.(客户端没有调用mysql_close()函数)
  • The client had been sleeping more than wait_timeout or interactive_timeout seconds without issuing any requests to the server. (客户端的空连接时间过长,超过了wait_timeout和interactive_timeout的时间)
  • The client program ended abruptly in the middle of a data transfer.(数据传输过程中终结)

1、调整max_allowed_packet参数

max_allowed_packet=500M

发现调整后还是有类似问题。


2、查看系统断开时间

show variables like '%timeout%';
0a514bf1ae1e62e3822e76ab25b0e4af.png

参数介绍 :

首先说明两个关键词 通过MySQL 客户端连接db的是交互会话,通过jdbc等程序连接db的是非交互会话

interactive_timeout: MySQL服务器关闭交互式连接前等待的秒数。交互式客户端定义为在mysql_real_connect()中使用CLIENT_INTERACTIVE选项的客户端。参数默认值:28800秒(8小时)

wait_timeout: MySQL服务器关闭非交互连接之前等待的秒数。在会话启动时,根据全局wait_timeout值或全局interactive_timeout值初始化会话wait_timeout值,取决于客户端类型--由mysql_real_connect()的连接选项CLIENT_INTERACTIVE定义。参数默认值:28800秒(8小时)


3、配置文件注释这两个参数,重启数据库服务

341be3c94516b857c555c20a7bb1ddd0.png

4、重新观察

e3803794df0bdab0b6701768672ef3cb.png

觉得有用的朋友多帮忙转发哦!后面会分享更多devops和DBA方面的内容,感兴趣的朋友可以关注下~

f15e5866afff957228c45d6626ab7d82.gif
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值