Mysql – Intermittent “Lost connection to MySQL server at ‘reading initial communication packet'”

MySQLnetworking

Our web environment consists of two servers.

  1. Web front-end. Dell PowerEdge R610, RHEL 5.5, Apache 2.2.17, php 5.2.14.
  2. Database server. Dell PowerEdge R710, Windows 2008 R2 Standard x64, MySQL 5.5.11-log x64.

Normally these two work perfectly fine together. However, when I try to get them talking via a dedicated LAN on their secondary NICs (each machine has four of them), things get flaky. I have NIC #2 on both machines configured on the 172.16.1.0/24 subnet, with no gateway or DNS servers (obviously, since it's just those two systems), and I put the private IP address of each machine into the hosts file of the other. The routing tables on both machines look okay after I do this.

I've tried this with both a crossover cable draped directly between the two NICs, and also via a dedicated vlan on the switch in the rack. In either case, I get intermittent connection problems. It's a fairly small percentage of connections that fail, but it's enough to cause a significant problem, and I have to switch back to the main network connection, which will contend with all the other traffic and hosts on the switch.

The full error message that appears in the application log:

SQLSTATE[HY000] [2013] Lost connection to MySQL server at 'reading initial communication packet', system error: 110

Am I doing something really dumb that's causing this to not work properly? Anything I can check in MySQL that would explain why it's failing to connect occasionally?

Best Answer

The first thing I would rule out is the packet size, not for the network, but for MySQL. Make sure you set max_allow_packet to a large enough value, especially if your website is using BLOB data.

I saw a strange forum concerning this same issue. The forum discusses something about removing or playing around with a bind address dispite remote connections.

Please look at this and see if it helps.