We've just upgraded our existing MySQL5.1 DB servers to newer (much better) hardware with MySQL 5.5, and things have been going mostly smoothly for almost 6 weeks.

Just the last few days, I've noticed a few errors, such as:

From a MySQL Slave:

[ERROR] Error reading packet from server: Lost connection to MySQL server during query ( server_errno=2013)

Or From Apache/Other:

Lost connection to MySQL server at 'reading initial communication packet', system error: 110

At one point this evening, many webnodes reported this error for a three minute period (many such reports as this was in a busy period). However, the issues don't appear to correspond with any times of extreme load. For all intents and purposes, the connection/thread load on MySQL is at a normal rate (between about 10 and 40 connected threads), and Web load has been a LOT higher at times over the last few weeks.

Could there bee other reasons for these connection errors, that I'm not seeing?

  • sysctl -a, networking tuning, timeout settings, keepalives, buffer size. I hope, it's not a Broadcom NIC ^_^
    – GioMac
    Jun 27, 2013 at 22:10

3 Answers 3


Hooray, tuning the max_allowed_packet variable, increasing its value and restart MySQL. It will provide major capacity for MySQL in reading packets. Try it out and give us a feedback.

  • Hi Wagner, I tried this about a week ago, and it seems to have partly alleviated the problem, but not completely. I've been looking into client timeouts on our webnodes too, but mostly just experimentation at the moment!
    – kwiksand
    Jun 21, 2011 at 19:30
  • Was it set on master and slave ?
    – thinice
    Dec 18, 2012 at 3:29

error 110 is "Connection timed out", which suggests that something is happening to the network between your client and MySQL server. Aside from network issues, you could also see this if the server is far too overloaded to respond to the incoming connection.


you can try upping wait-timeout or connect-timeout, but this may be masking the root issue. you may have a bad query making mysql processes stack up. check (or enable) your sql slow log. run mysqltuner to possible adjust variables. read the tuning mysql section of mysql docs, and make sure your directives are sane.

EDIT: on the application layer, ie php, you can have the php script die if it does not finish within a period of time, by adjusting the max_execution_time directive

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.