Can't Connect Wordpress Droplet to MYSQL Database on a PHPMyAdmin Droplet

Posted February 26, 2021 327 views

Can’t seem to connect my wordpress quick install droplet to my phpmyadmin droplet with mysql database

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.

Submit an Answer
2 answers

Hello @mlmarinas ,

Could you please confirm if you’re referring to the phpMyAdmin one-click install from the marketplace? Also, are you using the WordPress one-click install from the marketplace as well?

What is the exact error that you’re receiving when you’re trying to connect?


Hi @mlmarinas,

As far as I understand, you have two Droplets, one that hosts your databases and has phpMyAdmin installed and another that hosts your WordPress website, correct?

If that’s the case and you want to allow connections to MySQL from the WordPress droplet to the Database one, you’ll need to adjust your firewall.

If you are using Iptables you can SSH to your Database Droplet and type in the following :

iptables -A INPUT -p tcp -s 0/0 --sport 1024:65535 -d XXX.XXX.XXX.XXX --dport 3306 -m state --state NEW,ESTABLISHED -j ACCEPT
iptables -A OUTPUT -p tcp -s XXX.XXX.XXX.XXX --sport 3306 -d 0/0 --dport 1024:65535 -m state --state ESTABLISHED -j ACCEPT

Just remember to change XXX.XXX.XXX.XXX with the IP of your WordPress droplet.

If you are using UFW, you can type in the following :

sudo ufw allow from XXX.XXX.XXX.XXX to any port 3306

Again, you’ll need to change XXX.XXX.XXX.XXX with the IP of your WordPress droplet.


  • Did not work for me. I have the database host set to XXX.XXX.XXX:3306 in my wp-config.php which is the IP of the phpmyadmin one click install. Is this correct?

    • Hi @mlmarinas

      Yes, that should be correct.

      If you try to do

      telnet XXX.XXX.XXX.XXX 3306

      from your web droplet where XXX.XXX.XXX.XXX is the Database’s droplet IP what is the output?