Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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 
    HostName        1.1.1.1 
        Port            3000 
        IdentityFile    ~/.ssh/%r 


Host vps1tunnel 
        HostName        1.1.1.1 
        Port            3000 
        IdentityFile    ~/.ssh/%r 
        # MySQL 
        LocalForward    localhost:3306 1.1.1.1: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

1 Answer 1

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

 
discard

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.