Cannot Connect To Private Network MySQL

2 droplets same data center, same project. Both droplets are behind the same firewall.

I am attempt to connect from Droplet 1 to MySQL on Droplet 2 however, I keep getting: “ERROR 2003 (HY000): Can’t connect to MySQL server on”

telnet 3306 Trying… telnet: Unable to connect to remote host: Connection refused

Telnet over port 22, 80, 443 is all fine. I can ping ok.

I have set my mysql.cnf file to bind over I have set up a user with the @ % for the sake of debugging the connection issue, but still no luck. I restarted mysql I flushed the privileges.

netstat -tulnp | grep mysql tcp 0 0* LISTEN 23317/mysqld

What am I missing here?

Thank you!!

Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

@dpp777 did you ever find a solution to this? I’m in the exact same boat as you.

the forum is rejecting my reply as spam, so putting this in the answer section to help share more information.

Both droplets (Ubuntu 16) are behind the DigitalOcean firewall, so that should not be blocking anything as they are connected to each other via private network. I did open port 3306 on the DigitalOcean firewall and it had no effect.

iptables are not enabled: service iptables stop Failed to stop iptables.service: Unit iptables.service not loaded.

I ran ufw allow mysql No change in connecting.

I ran ufw disable on both droplets ufw disable Firewall stopped and disabled on system startup

At this point 3306 is an open port in the digitalocean firewall. ufw is completely disabled on both boxes

yet I still get: telnet 3306 Trying… telnet: Unable to connect to remote host: Connection refused

mysql -u username -p -h privateNetworkIP Enter password: ERROR 2003 (HY000): Can’t connect to MySQL server on ‘xx.xx.xx.xx’ (111)

But: telnet 22 Trying… Connected to Escape character is ‘^]’. SSH-2.0-OpenSSH_7.2p2 Ubuntu-4ubuntu2.4

telnet on port 80 also works, but ssl port 443 fails like 3306

DigitalOcean Firewall Settings: Inbound Rules Type Protocol Port Range Sources

SSH TCP 22 All IPv4 All IPv6 HTTP TCP 80 All IPv4 All IPv6 HTTPS TCP 443 All IPv4 All IPv6 MySQL TCP 3306 All IPv4 All IPv6

Outbound Rules Set the Firewall rules for outbound traffic. Outbound traffic will only be allowed to the specified ports. All other traffic will be blocked. Type Protocol Port Range Destinations

ICMP ICMP All IPv4 All IPv6 All TCP TCP All ports All IPv4 All IPv6 All UDP UDP All ports All IPv4 All IPv6

Any other ideas?

I appreciate the help on this!

This comment has been deleted