程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
 程式師世界 >> 數據庫知識 >> MYSQL數據庫 >> MySQL綜合教程 >> MySQL ERROR Got an error reading communication packets,communicationerror

MySQL ERROR Got an error reading communication packets,communicationerror

編輯:MySQL綜合教程

MySQL ERROR Got an error reading communication packets,communicationerror


介紹

經常會在錯誤日志中看到這個報錯,首先我們可以從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:

  • 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. See Section 5.1.4, “Server System Variables”.

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錯誤的大概原因有:客戶端連接一個沒有授權的數據庫、密碼錯誤、連接包信息錯誤、連接超時(默認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:

  • The client program did not call mysql_close() before exiting.

  • The client had been sleeping more than wait_timeout or interactive_timeout seconds without issuing any requests to the server. See Section 5.1.4, “Server System Variables”.

  • The client program ended abruptly in the middle of a data transfer.

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的原因大概有:客戶端沒有執行mysql_close()關閉、由於連接一直沒有關閉導致時間超過wait_timeout or interactive_timeout這兩個變量的值(這兩個變量的超時時間是8小時)、客戶端在程序執行過程中結束、max_allowed_packet包設的過小、網絡原因、線程bug等

總結

 

 

 

備注:

    作者:pursuer.chen

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

本站點所有隨筆都是原創,歡迎大家轉載;但轉載時必須注明文章來源,且在文章開頭明顯處給明鏈接。

《歡迎交流討論》

  1. 上一頁:
  2. 下一頁:
Copyright © 程式師世界 All Rights Reserved