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

windperson profile image Chen Yu Pao ・1 min read

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.

Posted on Oct 25 '19 by:


markdown guide