I've got a linux (ubuntu) computer at work from where I can connect to an external mysql server (not on company NAT). I've also got a laptop from which I want to connect to the mysql server but outside the work network.

How can I setup iptables or ssh port forwarding on my workstation so that it forwards connections to it (from my laptop at home) to the external mysql server?

link|improve this question
feedback

1 Answer

up vote 2 down vote accepted

If you can ssh into your work computer do this on your home computer:

ssh -L 3306:mysqlserver:3306 user@workcomputer

and to connect to mysql, run this on your home computer:

mysql -h localhost

This forwards your local port 3306 off to the mysql server that your work computer can connect to.

link|improve this answer
I removed the comment where I said that this was not what I wanted because it was exactly what I wanted I just didn't understand it. Works great, thanks! – Marlun Apr 8 '11 at 12:47
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.