user7796543
user7796543

Reputation:

How to access a remote mongodb through Compass?

I'm trying to connect to a mongodb database remotely.

I have the following information:

  1. mongo DB on x.x.xxx.xxx
  2. Username: tempUser
  3. Password: tempPass
  4. Host: localhost
  5. port: 27017
  6. needed port forwarding in order to access the DB as port 27017 is not open.

I've already tried to connect from console but I fail.

Is there a way to connect from Compass while I forward the port?

Upvotes: 4

Views: 13389

Answers (2)

Mohiuddin Khan
Mohiuddin Khan

Reputation: 523

When you want to connect to your instance from your workstation anywhere , ssh tunnelling is the way to go.

To use SSH Tunnel While creating a connection on MongoDB Compass , you need to choose it from the drop down box for the other text boxes to show up. Image for post The upcoming fields are pretty standard SSH information , nothing specific for MongoDB.

enter image description here

enter image description here

enter image description here

Upvotes: 9

heydar dasoomi
heydar dasoomi

Reputation: 557

If the port is open you can connect it with this command:

mongo --host ip -u user name -p password

Upvotes: -1

Related Questions