How do I connect MySQL Workbench to my VPS?

Posted February 21, 2014 31k views
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!

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.

Submit an Answer
11 answers

The key on a 2 server setup for me was to have the full internal address for the MySQL Hostname, i.e. - without this it just wouldn’t work and it was by a LOT or trial and tests that I managed to get this to
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:
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!

A more secure way would be keeping MySQL on the loopback interface and tunneling port 3306 to your local computer:
In this article, you'll learn how to create a safe, encrypted tunnel between your computer and your VPS along with how to bypass limits in a corporate network, how to bypass NAT, etc.
Basically you'll need to have MySQL service listen to the public IP for remote connections since by default it listens on the loopback adapter.

Look at these two posts that might answer your question:
@kamal can you provide me with a very simple tutorial. i can't understand the link you provided.please.
@Tekeste: Try following Example 1 in that article and replacing port 110 with port 3306.

MySQL Workbench works without any configuration necessary. When making a new connection, select “Standard TCP/IP over SSH”, then change the SSH and MySQL parameters as necessary. (You should probably keep the SQL server IP address as

For those of you still searching, here’s the command you can use based on @kamaln7 ’s suggestion.

Thank you Rupert. You reply above saved me alot!

Previous 1 2 Next