Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have two webservers that are essentially clones of each other, both connecting to a remote MySQL server with the same username/password.

The problem is, one of them connects just fine, but the other one gives me this error:

Warning: mysql_connect(): Lost connection to MySQL server at 'reading initial communication packet', system error: 111 in /var/www/includes/classes/DB.php on line 34 Connection has failed

Both servers have the same DB.php file with the same settings. The firewall is allowing all connections to port 3306. I've commented out the default bind-address of I've granted permissions to my user and ran FLUSH PRIVILEGES.

Is there something else I'm missing? Why would one server be able to connect but not the other?

share|improve this question
What happens when you run telnet 3306, substituting the appropriate hostname? – Andrew M. Dec 6 '10 at 2:54

I was missing something.

iptables was the culprit. There were rules added by the old sysadmin that only allowed the one webserver to connect. Added a rule and off we go!

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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