Connection Via SSH Tunnel (MySQL)

Due to security considerations we do not allow connections to our normal MySQL server from outside our network. The negative impact it will bring to our customers is that (but on) can not connect to their databases via external software (eg MySQL Workbench) which is troublesome for many who prefer to work on these instead of via our web-based tools (such as phpMyAdmin). The solution to this is to use their SSH account with us to create a tunnel to send their traffic through and thus be able to make the connection from an external location.

Before, you can start you need to make sure your tools are ready:

a) SSH account: this guide assumes that you have already set up an SSH account. If you have not done it yet, check THIS LINK for a guide that describes how to do this.

b) SSH client: If you shouldn't have a SSH client yet, then please get one. There are plenty of free tools you can find in the internet. One of them is Putty. You can download that tool from e.g. THIS PAGE.

Now, when your SSH account and your SSH client is ready, perform the following steps to create a  SSH tunnel:

 1. Start Putty and add an account. In the "Host Name" should read ssh.servage.net and in "Saved Sessions" choose a name for the connection. You can choose the "real name" when you set up the SSH account to avoid confusion.

 

 

2. In the left menu, navigate now to Connection> SSH> Tunnels

3. Start by typing 3306 in the "Source port". In the "Destination", enter the host name of the database server followed by :3306 

See picture below:

 

 

4. Then click "Add" button (highlighted in the image above).

5. Go back to the Sessions (the same view as the first image in this guide) in the left menu and click "Save".

6. Start up your tunnel by clicking on "Open".

7. Enter your SSH login and password:

 

 

Your SSH tunnel is active! Make sure not to shut down Putty while you should use the tunnel. You can now start working with your database, enter 127.0.0.1 as the host name, and your database data.

You can login using your SQL-client like for example MySQL Workbench. In this example, we use MySQL Workbench, then it looks like this:

 

 

Please consider

If you already have a local MySQL server on the same machine that you want to start your SSH tunnel from this will not work as they respond to the same port (3306).