Server Fault is a question and answer site for system and network administrators. 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 a problem tunneling a ssh connection to a remote server to use Mysql.

I try:

ssh -L 3306:localhost:3306 root@vps1

and works perfectly! (I tested the connection using Mysql WorkBench)

BUt if i do:

ssh root@vps1tunnel

I CAN connect but Mysql WorkBench can't connect to the remote server using the tunnel.

These are the zones in my ssh_config

Host vps1 
        Port            3000 
        IdentityFile    ~/.ssh/%r 

Host vps1tunnel 
        Port            3000 
        IdentityFile    ~/.ssh/%r 
        # MySQL 
        LocalForward    localhost:3306

So now I would like to "CONVERT":

ssh -L 3306:localhost:3306 root@vps1

in a ssh_config zone

Could someone help me?

share|improve this question
up vote 7 down vote accepted

You want

LocalForward 3306 localhost:3306

Because, as with the -L option, the 'remote' address in the LocalForward option is relative to the SSH server, not the client.

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.