Connect to a remote MySQL server with MySQLBrowser using SSH

Problem

You would like to connect to a remote MySQL server using the Mysql-query-browser GUI tool, and you only have localhost access to the remote server, but also have ssh access to the remote server.

 

Solution

You can use the following command to start a port forwarding to your localhost and then use that to connect to the remote database server:

ssh -L 3307:localhost:3306 user_name@remote_host -N

You could then use the following to the Mysql-query-broser connection:

 

Hostname: 127.0.0.1
username: db_user_name_on_remote
password: db_user_password_on_remote
port: 3307