Report this

What is the reason for this report?

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

Posted on February 26, 2021

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



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!

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.

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?

https://marketplace.digitalocean.com/apps/phpmyadmin

https://marketplace.digitalocean.com/apps/wordpress

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

Regards, Alex

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.

Regards, KFSys

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.