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?
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!