有趣生活

当前位置:首页>科技>mysql数据库语句错误mysql数据库常见报错之Timeout

mysql数据库语句错误mysql数据库常见报错之Timeout

发布时间:2026-07-21阅读(1)

导读概述在观察某个数据库错误日志的时候发现一直在刷错误信息:2019-09-20T07:41:17.933680Z1936[Note]Abortedconnec....概述

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

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

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


思路

可能导致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%;

参数介绍 :

首先说明两个关键词 通过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、配置文件注释这两个参数,重启数据库服务


4、重新观察


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

Copyright © 2024 有趣生活 All Rights Reserve吉ICP备19000289号-5 TXT地图HTML地图XML地图