How to tunnel a mysql connection to your remote server

June 15, 2009    mysql tunnel ssh

Today I spent alot of the day sorting our development techniques to bring a best practise into what we do. We needed to both be able to connect to the same remote database but both be able to develop locally. So we decided to setup ssh tunnels to our mysql server.

You can quite simply open a ssh tunnel with your server using the following:

ssh -L

You can then connect to the server with php using the following,

DB_USER - root - DB_HOST - :3307 - DB_NAME - db_name DB_PASS - root pass

blog comments powered by Disqus