Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have tried using the mysql-workbench but it was too confusing, then I decided to use emma instead. I am trying to connect to my MySQL DB through SSH, but I don't see that option when I try to make a new connection. Any suggestions? Thanks!

( I did try some researching but I could not find helpful results )

share|improve this question

You can create an SSH tunnel manually with:

ssh -L 33060:localhost:3306 user@remotehost

While this ssh session is open, connections to your port 33060 will be forwarded to (the standard mysql server) port 3306 on the remote server.

Then any mysql client can connect to the mysql server running on 'remotehost', e.g.:

mysql -P 33060 -h -u mysqluser -p

I've used this method to connect emma to a mysql server running privately (not accessible externally) on another machine before. Unfortunately, with this method, you have to establish the tunnel manually before emma's stored server connection will work.

share|improve this answer

A much more reliable way to create an ssh tunnel to a remote mysql database is to use gstm, the Gnome SSH Tunnel Manager...

sudo apt-get install gstm

Then run the gui application, create a named config for your connection, with host set to destination host and port set to 22 (probably) as the ssh port. Tick autostart if you want this tunnel to auto-launch on start up. Then add a port redirect, type local, port 33060, host same as destination, to port 3306.

One thing to note is that in clients, php config etc, you will probably want to use rather than localhost:3306 because reasons. (Something to do with sockets).

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.