Was trying to connect to a PostgreSQL database running through VirtualBox locally, but is only exposed though SSH. In order to do that, I have to connect through an SSH tunnel. I found the following article here http://www.heidisql.com/forum.php?t=15472 that says:
SSH tunnel is built into HeidiSQL for MySQL only. For using a tunnel to a PostgreSQL server, you will need to start a plink.exe command line seperately, and then let HeidiSQL connect to 127.0.0.1 on the port you specified in the command line.
But I had no idea how to do that!
Did some research, and here’s what I ended up running that worked for me:
Make sure you have Putty installed (which included plink.exe). Open up a windows command prompt and navigate to the folder you have the Putty executables:
cd "C:\Program Files (x86)\PuTTY"
From there, run the following:
plink -L 5432:localhost:5432 "my local ssh profile"
where “my local ssh profile” is the name of the session config you have saved in PUTTY.
What this does it route all requests from localhost port 5432 to the connection it created through PUTTY and forwards them to the same port (hence the second 5432)
Now you just need to change the config for HeidiSQL to connect to ‘localhost’, port 5432. Then provide the user and password for the postgres database user you want to connect with.
Hope that helps!