Unsupported Screen Size: The viewport size is too small for the theme to render properly.

Multiple Ssh Hosts To Tunnel

forums forums SQLyog Using SQLyog Multiple Ssh Hosts To Tunnel

  • This topic is empty.
Viewing 4 reply threads
  • Author
    Posts
    • #12632
      sanko
      Member

      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(SQLYog)


      SSH(port 22)—>BOX1(IP: 190.xx.xx.xx)—SSH(port 22)—>BOX2(IP: 190.xx.xx.xx)[MySQL server]

      I have checked with SQLYog SSH tunnel feature . I see it has one SSH Host credentials to key in.

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

      I need your help at this part. Could you please post steps to try with ?

      Yhanks

    • #33246
      sathish
      Member

      Hello,

      Try this command from MyBox(having SQLyog)

      Code:
      ssh user@box1 -L some-local-port:box2:22

      Now from SQLyog connect this way

      MySQL host : localhost

      MySQL usernmae : mysql-username-of-server-installed-at-Box2

      MySQL password : mysql-password-of-server-installed-at-Box2

      MySQL port : 3306 (suppose mysql server at Box-2 is listening at port 3306)

      In SSH tab tunnelling info

      SSH host : localhost

      SSH pass : ssh-password-of-Box2

      SSH port : some-local-port

      Regards,

      Sathish

    • #33247
      peterlaursen
      Participant

      Let me put the question another way: how would you do that with Putty or Plink for instance? As far as I can see this will have to be handled in the SSH configuration of Box1. You/SQLyog will authenticate against Box1 and Box1 will authenticate against Box2.

      (and you cannot execute 'ssh' command on WIndows unless you have Cygwin or similar installed)

    • #33248
      peterlaursen
      Participant

      Atter some internal discussion the conclusion is that you cannot do this from the SQLyog connection manager. You will need to create the tunnel with an external program.

      We will explain in detail shortly how you can use Putty in combination with SQLyog for this.

    • #33249
      sathish
      Member

      Hello,

      It can be done as follows

      1. Open Putty

      2. In session put the credential of BOX1

      3. Goto Connection -> SSH -> Tunnels in putty

      • Add Source Port = 10000 (this will be a localport in your MyBox(SQLYog), you can change this port depending on availability of open port)
      • Add Destination = BOX2:22
      • Click on add

      4. Connect

      Alternatively in Linux you can use this command

      Code:
      ssh user@BOX1 -L 10000:BOX2:22

      Now from SQLyog connect this way

      MySQL host : localhost

      MySQL usernmae : mysql username of BOX2

      MySQL password : mysql password of BOX2

      MySQL port : mysql port of BOX2

      In SSH tab tunnelling info

      SSH host : localhost

      SSH pass : SSH password of BOX2

      SSH port : 10000

      Note : You have to keep the SSH session to be opened whenever you are using this connections.

      Regards,

      Sathish

Viewing 4 reply threads
  • You must be logged in to reply to this topic.