Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

How do I connect to MySQL database through two SSH hosts ?

Here is my situation: I have two SSH hosts as show below. MySQL is running in BOX2 host.

MyBox(GUI client) -----SSH(port 22)--->BOX1(IP: 190.xx.xx.xx)---SSH(port 22)--->BOX2(IP: 190.xx.xx.xx)[MySQL server]

My question is how do I connect if I have multiple SSH hosts to tunnel as shown above ?

share|improve this question
1  
Why can't you just SSH to Box2 directly? Or if your MySQL server was compiled with SSL support, you could just initiate an SSL connection to it directly without an SSH tunnel. –  Lèse majesté Apr 5 '12 at 10:59

1 Answer 1

You can set a ProxyCommand to connect transparently from MyBox to BOX2 (using BOX1 under the hood), so you can setup a -L redirection directly from MyBox to BOX2. Please read: transparent multihop SSH to get more details.

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.