I can't connect to remote MySQL!

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.

Hey friend!

Let’s simplify all of this a bit with a theoretical scenario:

  • MySQL is on server
  • I need server at to connect to database “digitalocean” on

On server I make sure that bind-interface is set to I check this with “netstat -tulpn” to make sure MySQL isn’t just listening on If it is, then I haven’t set bind-address, and need to work on that before continuing. Otherwise, I continue by running this in MySQL shell on

create database digitalocean;


grant all on digitalocean.* to 'jarland'@'' identified by 'mypassword';

Now on I run:

mysql -h -u jarland -pmypassword digitalocean

Then I should have a MySQL shell. If I don’t, and no firewall is blocking port 3306 outbound on or inbound on, I didn’t do one of the above steps.