On windows I used to use Bitvise Tunnler to foward all traffic on my PC's localhost:33306 over an SSH connection to my server – and then from there to the mysqlserver:3306 server database.
PC:33306 -> server:3306 -> databaseserver:3306
Now that I'm using linux I find that it is easy to SSH anywhere anytime with:
ssh user@site.tld
However, I'm not sure how to replicate this port forwarding using the ssh options. If it was just from one computer to another I think I could do something like this…
ssh -L 33306:localhost:3306 user@site.com
UPDATE
I have tried connecting using the following SSH and the connection seems to work.
ssh -L 33306:localhost:3306 user@otherserver.com
But phpMyAdmin throws this error when trying to connect to the other server
#1045 - Access denied for user '[[user]]'@'localhost' (using password: YES)
Then I tried
ssh -L 33306:db.server.com:3306 user@otherserver.com
and phpMyAdmin threw this error
#1045 - Access denied for user '[[user]]'@'localhost' (using password: YES)
running netstat -an | more shows
tcp6 0 0 ::1:33306 :::* LISTEN
Again, the process flow should look like this:
mypc -> server -> otherdbserveronprivatelan
Best Answer
This should do:
ssh -L 33306:databaseserver:3306 user@site.com