Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

I have full SSH access.

Is this possible? Reverse SSH? VPN? (but it seems like it would be a bit confusing)

share|improve this question
up vote 2 down vote accepted

With SSH this is quite easy.

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

On machine C you simply do this:

ssh -L 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.

share|improve this answer
awesome! thanks! – vonhogen Nov 14 '09 at 21:16

It's probably not what you had in mind, but if the mysql server was also a web server, and you used PHP on the server to access the db as localhost, would that fit your description of no remote access?

The "local app" would be your browser.

PHPmysqladmin (is that right? I've never used it) would give you administrative access, but then if you have SSH access to the server, you could use mysql for administration.

share|improve this answer
basically, I am hosting an app on a server, and I want to debug it on my own machine. mysql does not allow remote connections by default. I don't want to change that. – vonhogen Nov 14 '09 at 12:54
Is the app you're hosting on a server a web app at all? My point was that (for example) PHP running on the a server accesses a database as localhost, so it's not necessary to configure remote access to mysql. But, of course, if your app doesn't access mysql like PHP would, I'm talking out of my hat. I'm not sure why you mentioned 'reverse ssh', but it's probably because I'm not really familiar with the subject. Good luck finding a solution. – pavium Nov 14 '09 at 13:23

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .