How to SSH into remote database from Windows

If you find yourself with a bust Mac and you have to fall back on your old ‘reliable’ windows laptop. You need to connect to your development web server using SSH, where do you start… I’ll tell you where, Google, or you may find this guide of some use.

So firstly, I need to set up PuTTY, a free and open source terminal emulator that will allow me to SSH into my remote web server.

Download PuTTY here.

Once downloaded, I need to generate a public/private key to authenticate the SSH connection from my machine to the web server.

Use another tool – PuTTYGen to generate the keys for you.

Download PuTTYGen here.

Here’s a pretty straightforward guide that I cannot be arsed to repeat on how to create the key. One difference for me was we use DSA encryption.

HANDY TIP: If you wish to use this key on a Mac (like I did once it was repaired) so that you can connect from either machine (windows or mac), then do the following.

Once you have your key created you need to export the key as an OpenSSL key and save it for later.

On with the guide…

By now you should have your keys, your public one should be up on your server, your sacred private key should be in on your local machine.

You now open PuTTY to connect to your server.

Enter you host name / ip address to your server. So something like…

Now to add your private key to the equation. On your right you will see an SSH option, click it to reveal more options… select the ‘Auth’ option.

Now use the Browse button to select your newly created private key.

Now return to the initial screen, Session (where you entered your development web server’s hostname )… give the session a name and save… then Load and BOOM, you should have a new terminal window to your server.

Okay, now the port forwarding. In my case, remote access is not permitted to our development database. However you can connect to it from your development web server.

So, if I can use port forwarding to make a MySql client connect to the development database through the web server then I can access the database locally… which is handy.

The following guide helped me.

Now I know, what the heck… that’s a better guide than this one, but bare with me. I tried to follow that guide and I got stuck. Some of you may not have, but I think there is something in guides like this that do not nail home.

Umm something like, “What IP address and what port do I use and where do I put it!“…

I guess I got confused over source and destination fields.

To safe you the bother, your Source address is  (or localhost) and your source can use any Port you wish, like 3006 in the example given in the guide above.

The Destination address is the address you normally use to connect to your database from your web server ( probably in some config file ). Looks something like, or…

You insert this hostname/port into the destination field below (where the confusing is now), and whatever port you wish to use as part of your source address, in our case we’ll stick with 3006

Then open your MySql client and insert your source address details, and port 3006, enter your Username/password and click the connect button… and all going well you have local access to your remote database server through a secure SSH Tunnel… sweet!

5 thoughts on “How to SSH into remote database from Windows

  1. Loved your site. It saved me many hours tonight.

    FYI, the prhase is “stumble upon” not “stumple upon”

    1. Thank you. For some reason I always spell it that way though I know better, perhaps some mental blind spot. By the way, where did you see this misspelling?

      1. It is in your tagline “A nest for the random, shiny, online tidbits I stumple [sic] across…”

        I thought maybe it was an inside joke.

        I wouldn’t have mentioned it if it was just in some isolated post.

        Thanks again for the tech tips…

Leave a Reply

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

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

Facebook photo

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

Connecting to %s