介绍经常会在错误日志中看到这个报错,复制官方文档的解释。   Aborted_connects Ifaclientisunableeventoconnect,theserverincrementsthe Aborted_connects statusvariabl"/>

MySQL ERROR Got an error reading communication packets

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了MySQL ERROR Got an error reading communication packets相关的知识,希望对你有一定的参考价值。

介绍

经常会在错误日志中看到这个报错,首先我们可以从show GLOBAL status like \'%Aborte%\';里面看看两种错误连接的数量,以下是复制官方文档的解释。   

 

Aborted_connects 

If a client is unable even to connect, the server increments the Aborted_connects status variable. Unsuccessful connection attempts can occur for the following reasons:

If these kinds of things happen, it might indicate that someone is trying to break into your server! If the general query log is enabled, messages for these types of problems are logged to it.

 

对于Aborted_connects错误的大概原因有:

1.客户端连接一个没有授权的数据库

2.密码错误

3.连接包信息错误

4.连接超时(默认10s)

Aborted_clients

If a client successfully connects but later disconnects improperly or is terminated, the server increments the Aborted_clients status variable, and logs an Aborted connection message to the error log. The cause can be any of the following:

Other reasons for problems with aborted connections or aborted clients:

  • The max_allowed_packet variable value is too small or queries require more memory than you have allocated for mysqld. See Section B.5.2.10, “Packet Too Large”.

  • Use of Ethernet protocol with Linux, both half and full duplex. Some Linux Ethernet drivers have this bug. You should test for this bug by transferring a huge file using FTP between the client and server machines. If a transfer goes in burst-pause-burst-pause mode, you are experiencing a Linux duplex syndrome. Switch the duplex mode for both your network card and hub/switch to either full duplex or to half duplex and test the results to determine the best setting.

  • A problem with the thread library that causes interrupts on reads.

  • Badly configured TCP/IP.

  • Faulty Ethernets, hubs, switches, cables, and so forth. This can be diagnosed properly only by replacing hardware.

 

对于 Aborted_clients的原因大概有

1.客户端没有执行mysql_close()关闭

2.由于连接一直没有关闭导致时间超过wait_timeout or interactive_timeout这两个变量的值(这两个变量的超时时间是8小时)

3.客户端在程序执行过程中结束

4.max_allowed_packet包设的过小

5.网络原因

6.线程bug等

总结

 

 

 

备注:

    作者:pursuer.chen

    博客:http://www.cnblogs.com/chenmh

本站点所有随笔都是原创,欢迎大家转载;但转载时必须注明文章来源,且在文章开头明显处给明链接。

《欢迎交流讨论》

以上是关于MySQL ERROR Got an error reading communication packets的主要内容,如果未能解决你的问题,请参考以下文章

MySQL技术专题「问题实战系列」MySQL报错Got an error reading communication packets问题分析指南

mysql 错误 ERROR 1030 Got error 28 from

spark报Got an error when resolving hostNames. Falling back to /default-rack for all

MySQL Cluster ERROR 失败,查询时出现错误'Got error 240'Unknown error code' from NDBCLUSTER'

mysql主从同步失败Last_IO_Error: Got fatal error 1236 from master解决方法

mysql主从同步失败Last_IO_Error: Got fatal error 1236 from master解决方法