Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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 127.0.0.1. 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 failing.server.com 3306, substituting the appropriate hostname? –  Andrew M. Dec 6 '10 at 2:54
add comment

1 Answer 1

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
add comment

Your Answer

 
discard

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.