MongoDB compass connection - ECONNREFUSED

Not able to connect to mongoDB from a different machine using compass or cmd.

Ports are opened.
Able to ping destination.
Use as the connection string with port 27017.
mongoDB: v6 means the localhost not a different machine.


I should have rather specified that I’m using in the net.bindIp, when testing the connection from another machine I used the ip address of the machine where my db instance is.

I also tried replacing me net.bindIp with the machine’s ip address.

note the net.bindIp configuration option

1 Like

For /tmp/mongod.sock, I do not see an tmp folder or a mongod.sock file, I have the /server/6.0/bin/mongod.exe and mongos.exe.
The mongos.exe does not run. The mongod does run, but I am not sure what role it has since I am able to access the database through compass and through my app when it isn’t running

I’m not using ipv6.

To connect to your mongodb from shell you need mongosh.Download and install it
mongod is to start a mongod instance
You should not run it since you already can connect with Compass
It will start a local mongod on the machine you started it provided it has required default params like default dbpath dir