What follow is how to set up as SSH tunnel using PuTTY with the MySQL port (3306) forwarded as an example. After completing this how-to you'll have port 3306 on your local machine listening and forwarding to your remote server's localhost on port 3306. Thus effectively you can connect to the remote server's MySQL database as though it were running on your local box.
mysql -h 127.0.0.1 rest of optionson the server. Look for
bind-address = 127.0.0.1and
skip-networking = 0in your
/etc/mysql/my.cnf. Also, a trouble-shooting guide.
psql -h 127.0.0.1 rest of optionsto test;
/etc/postgresql/pg_hba.confand the manual as pointers for configuration.