I'm using SqlYog and PUTTY in order to connect to a MySQL server sitting on a remote server. I'm able to the MySQL server sitting on the host I connect to through PUTTY, but the thing is I use PUTTY to make my way into a different server using two more SSH's in PUTTY. How do I connect to the third SSH's host's MySQL server??? I'm using for the primary SSH this tunneling: 3306:127.0.0.1:3306 And I connect to 3306 on localhost on SqlYog...
migrated from stackoverflow.com Jun 19 '11 at 18:08
This question came from our site for professional and enthusiast programmers.
So you appear to have four machines. Workstation (your starting point), and then serverA, serverB and serverC. You can SSH to serverA only. From there, you can only get to serverB and you have MySQL running on serverC. From workstation, you want to connect directly to MySQl on serverC?
Let's take this in steps. If you were running MySQL on serverB, and wanted to connect to it from workstation via serverA you would use this, from workstation.
That opens a connection to serverA from your workstation. On your workstation it listens on port 3306 and sends stuff it finds over the tunnel. The tunnel is actually to serverA but when it arrives, it shoves it to the destination which is serverB (port 3306).
You have an extra hop, so you need to put a new tunnel in first.
Connect to serverA via ssh as normal, and create a tunnel straight through to MySQL on serverC using,
Now, create the first part of the tunnel from your workstation,
Traffic sent to your workstation port 3306 is now routed all the way to serverC.