How do you connect a web droplet to a different MySQL database droplet?

I have two droplets. One is our website droplet and the second is the MySQL database droplet. Using the website droplet console I am trying to test the connection to the MySQL database droplet. I type mysql -u root -h hostname -p. I got an error message "Access denied for user root @ (using password: YES).

Any advice???

Show comments

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.

This question was answered by @asb:

In additon to @sierracircle’s suggestion, you might also want to check out the tutorial “How To Set Up a Remote Database to Optimize Site Performance with MySQL.” While it uses WordPress as the example, it should point you in the right direction for setting up a MySql server to be connected to remotely even if you are using something else.

View the original comment