MySQL can't connect to Private Network

May 22, 2015 3k views
Networking Firewall MySQL PHP Ubuntu

I can't seem to connect my WebApp to MySQL. I've setup 2 droplets with both Private Networking checked. Both servers can ping each other using the eth1 IP address.

Also when I execute nc -zv privatenetwork.db.server.ip 3306 the connection succeeds.

I also have UFW in place. The tricky thing about it is when I allow port 3306 to be accessed anywhere on UFW the WebApp can connect. Also when I set the port 3306 to be accessed by the public ip of the WebApp, again it can connect. But when I set the port 3306 to be access by the private ip of the WebApp it fails to connect.

Please enlighten me on why my WebApp can't connect to the Private Network.

  • By default MySQL will only listen on localhost. You will likely need to update your my.cnf file in /etc in order to have the MySQL service listen for connections on the private IP address.

  • Hi @ryanpq, thanks for the help. But I tried changing the bind-address to the private and public ip. Also I also tried commenting it to allow both connections. Still no luck on the issue

  • I know it has been 2 years since, did you get it working ?

Be the first one to answer this question.