1. Home
  2. Mojo Host Manager
  3. Connecting to MySQL via SSH tunnel with PuTTy
  1. Home
  2. Advanced Administration
  3. Connecting to MySQL via SSH tunnel with PuTTy

Connecting to MySQL via SSH tunnel with PuTTy

By default, port 3306 is closed to the outside world on all servers at MageMojo. This can be opened if needed, but if you want to use a local MySQL manager or other application, an SSH tunnel is preferred where possible.  SSH tunnels are possible with a variety of clients but in this example, we will be using putty.

Before you can connect, you need several pieces of information:

  • A working SSH login to your MageMojo server
  • The IP you will be connecting to MySQL from (this should be the same IP you whitelisted for SSH access)

If you have the above, you can proceed.

  1. Open PuTTy; you should see a screen like this:
  2. Enter your MageMojo.com servername in the hostname field.
  3. From the left-hand tree, go to Connection->SSH->Tunnels 
  4.  Set the source port to 3306 (this is the port on the server you want to use to get to MySQL) and the destination to 127.0.0.1:3306. This is the local port your local computer or application will use to connect to the MySQL server at MageMojo.
  5. Connect to the server by pressing the Open button.  Accept the SSH key if needed.
  6. Your tunnel is now open, connect locally using your MySQL client to 127.0.0.1 on port 3306. In the screenshot below MobaXterm was used to connect on the default port with a user named test_user and we can see the database via the MySQL CLI
Updated on June 21, 2017

Was this article helpful?

Related Articles