Server Fault is a question and answer site for system and network administrators. 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

I'm playing with MongoDB. I have a good deal of experience with MySQL and was using something called Sequel Pro to connect to remote databases. I'm now trying MongoHub but can't seem to get it to connect to the remote database.

I tried a basic SSH tunnel

ssh -f -L -N

But this didn't work. How do other DB management tools use a ssh login to provide a connection to the database that doesn't have an open port? Is this something I could setup by myself (via a tunnel or something else)?

share|improve this question
To talk to anything past a firewall you need an open port, what do you mean by something that doesn't have an open port? – jer.salamon Jun 23 '10 at 16:55
What connection string are you using to connect to the database? Can you connect to it with the command line mongo client? Can you telnet to localhost 9009? – Justin Dearing Sep 1 '10 at 18:09
up vote 5 down vote accepted

Here's what I do to get to my remotely mysql server (I've got mysql restricted to localhost only):

ssh -fNL 9999:localhost:3306 myuser@myremotemachine

To describe it,

  • -f puts it in the background
  • -N tells ssh there is no command to execute
  • -L 9999:localhost:3306 tells to bind the local port 9999 to 3306 remotely.

Then I use MySQL Query browser and tell it to connect to port 9999

So I suppose you could try:

ssh -fNL 9009:localhost:27017 myuser@myremotemachine
share|improve this answer

Your Answer


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.