Webserver can't connect to Remote Database using Private IP

I’m trying to connect my web server (planning to run Wordpress) to my remote database server on a private network, both hosted on Digital Ocean.

I’m currently using to install LEMP on my servers.

The issue I’m facing is, I can get private networking running fine:

  1. I can ping my DB server’s private IP
  2. Running nc -zv private_ip 3306 is successful
  3. Running mysql -u username -p -h public_ip is successful

Yet when I try connect to mysql (from my web server) using my private ip, I get the following output:

ERROR 1130 (HY000): Host 'webserver_private_ip' is not allowed to connect to this MariaDB server

I set up my private networking using this guide:

Any help in this is greatly appreciated

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.

If you have the ufw firewall enabled, you’ll need an allow rule for the connecting machine’s IP to use 3306 (the default db port)