Securely administer MySQL with an SSH Tunnel with PuTTY

Server administrators may wish to use local administration tools to connect to remote MySQL databases. This guide shows you how to do so in a secure manner using an SSH tunnel. We assume you have MySQL up and running, and that it is configured to listen on localhost (127.0.0.1) on the server. After following these instructions, you’ll be able to connect to localhost on your workstation using your favorite MySQL management tool.

1. Start PuTTY and enter your target host and select SSH as the connection type:

putty1

2. Setting up the tunnel

Go to “Connection -> SSH -> Tunnels” screen in PuTTY. Enter “3306” for the “Source port” field and “127.0.0.1:3306” for the “Destination” field, as shown below. Then click “Add”.

putty2

3. Save the connection profile and click “Open” to start an SSH session.

If you haven’t logged into this system with PuTTY before, you will receive a warning similar to the following. click “Yes” to accept:

putty3

Once you’ve connected to the remote server with this tunnel configuration, you’ll be able to direct your local MySQL client to localhost:3306. Your connection to the remote MySQL server will be encrypted through SSH, allowing you to access your databases without running MySQL on a public IP.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s