Take the 2-minute tour ×

and thank you for your help so far.

Here is my problem:

I have two remote dedicated servers, one webserver that runs apache, and one db server that runs mysql.

The apache server is visible on the internet of course, but the second server is only visible to the apache server because they are connected with LAN.

I need to connect to the remote mysql server through internet from my home-pc , but only apache server is visible to my home-pc. How can i setup port-forwarding from my apache server to the mysql server so i will be able to "see" the mysql server from my home-pc?

This question is a follow-up from my first question http://stackoverflow.com/questions/4159256/connect-to-remote-mysql-server-from-my-application-problem-is-that-mysql-server in which you answered me and helped me a lot by telling me to do "port-forwarding".

I looked over the internet, and i cant find a good how-to to do port-forwarding. I'm an experienced programmer, but have little experience on hardware and networks. I can understand though what must be done, so i just need a litle help to sort things out :)

I hope you can help me guys, Thank you in advance

p.s. machine that Apache is running is on CentOS, mysql server also CentOS. p.s2 webserver runs WebHostManager i dont know if that makes any difference or it can be made easily through this, i just mention it :)

share|improve this question

1 Answer 1

You don't. You SSH into the web server, creating a tunnel in your SSH tool that connects to the database server. You then connect to the local port with your database tool.

share|improve this answer
will the link i just posted above will do the work??? (thank you for your answer) –  karman888 Dec 2 '10 at 10:40
It should. Just make sure you get the correct remote hostname and port. –  Ignacio Vazquez-Abrams Dec 2 '10 at 10:41
thank you for your help. i really apreciate it mr Ignacio –  karman888 Dec 2 '10 at 10:45

Your Answer


