Home » Questions » Computers [ Ask a new question ]

Access Remote mysql database without allowing remote connections

Access Remote mysql database without allowing remote connections

How can I run an app locally to access the mysql database on my server without enabling remote access to the mysql server.

Asked by: Guest | Views: 249
Total answers/comments: 1
Guest [Entry]

"With SSH this is quite easy.

Let's assume that your DB is listening for connections on 127.0.0.1:3306 on machine S. You want to access that DB from machine C.

On machine C you simply do this:

ssh -L 127.0.0.1:3306:127.0.0.1:3306 S

As soon as you are logged in from C to S, C you will be able to use port 3306 on C as if it were on S. The first IP/port combination in that command line is the port you want to have locally, ie on C, the second one is the remote port that you eventually want to use."