Question

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

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


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.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

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

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