Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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?

share|improve this question

1 Answer 1

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.

share|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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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