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

I'd like to create several ssh tunnels to MySQL servers that are several hops away. I have ssh access to every server except the MySQL ones.

Here's how my setup looks like:

[desktop]=====[server]---------[mysql01]
                      \--------[mysql02]
                       \-------[mysql03]
                        \------[mysql04]

Currently, I can simply ssh into [server] and use mysql -h mysql01 -u something -p to establish a connection. Now, I want to create a tunnel for each of the MySQL servers so I can access them via a GUI on [desktop]. However, using ssh -L requires a user account on those MySQL servers, which I don't have.

Any ideas on how to work around this?

share|improve this question
add comment

1 Answer 1

up vote 1 down vote accepted

you could tunnel the Ports to your server.

ssh -L 3306:mysql01:3306 server

if you connect to server:3306 you end up on mysql01

Whats keeping you from entering mysql01 on the desktop gui?

share|improve this answer
    
That's the whole point! I need to be able to login to mysql01 to execute your command. I can't do that, because I don't have an account on that machine. –  Duru Can Celasun Jul 31 '12 at 7:37
    
no you don't need an account on mysql01. you need one on server which proxies to mysql01 –  Olli Jul 31 '12 at 7:40
    
I'm sorry but I don't get how that would work. Could you type a complete example which routes mysql01:3306 to, say, desktop:8890? –  Duru Can Celasun Jul 31 '12 at 7:55
    
the linux desktop example is [ssh -L 8890:mysql01:3306 server] On windows it would be in putty Connection->SSH->Tunnels: Source: 8890 Destination: mysql01:3306 [x]local [x]auto and then connect so [server] –  Olli Jul 31 '12 at 8:02
    
Aaargh! Thanks, I somehow thought I would need two separate tunnels, one on server, one on desktop. Excuse my stupidity, I'm not fully awake yet. –  Duru Can Celasun Jul 31 '12 at 8:08
add comment

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.