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:
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”.
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:
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.