Question

How do I connect MySQL Workbench to my VPS?

I am wondering if any one can tell me the correct method to connect to MySQL Server on my VPS using MySQL Workbench over SSH… I tried earlier and the connection was refused…

I don’t like using phpMyAdmin on a live server!


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.

The key on a 2 server setup for me was to have the full internal address for the MySQL Hostname, i.e. 127.0.0.1:3306 - without this it just wouldn’t work and it was by a LOT or trial and tests that I managed to get this to work…so: SSH Hostname: xx.xx.xx.x:22 of the DB server, which is also used as the bind address in my.cnf SSH Username: your admin username MySQL Hostname: 127.0.0.1:3306 MySQL Server Port: 3306 Username: whatever LOCAL , i.e. on the same db server, admin user you have set up on MySQL

You can then close it down as needed, e.g. with ufw on Ubuntu etc.

this took a LONG time to figure out so hopefully will save some peeps some time!

If yo’re still having issues with this, see this thread which solved the connection to MySQL Workbench for me: https://www.digitalocean.com/community/questions/trying-to-connect-to-mysql-database-server-through-mysql-workbench-using-ssh?comment=42464

A more secure way would be keeping MySQL on the loopback interface and tunneling port 3306 to your local computer: <a href=“https://www.digitalocean.com/community/articles/how-to-set-up-ssh-tunneling-on-a-vps”>https://www.digitalocean.com/community/articles/how-to-set-up-ssh-tunneling-on-a-vps</a>.