DEV Community

Chen Yu Pao
Chen Yu Pao

Posted on

How to access MySQL DB behind two ssh host using MySQL Workbench

If you have a server infrastructure like following:

[Win dev machine] <=ssh=> [Gangway Server] <=ssh=> [App Server] <--> [MySQL DB]

We can access DB via SSH Tunnel, following these steps:

  1. Using Git Bash or OpenSSH client for Windows 10, invoke command:

    ssh user_id@Gangway_Server -L 2202:App_Server:22 -N
    

    after typing the login password of user_id of Gangway Server, leave this terminal window opened.
    SSH Tunnel

  2. Open MySQL Workbench, create connection using Stand TCP/IP over SSH, other settings like this screenshot:

    Alt Text

After everything is done, close MySQL Workbench before closing the Terminal Window.

Top comments (0)