Njeru
Njeru

Reputation: 11

MongoDB connect failed

My problem here is that even after setting up mongod.exe "mongod.exe --install --logpath c:\mongodb\logs --logappend --dbpath c:\mongodb\data\db --directoryperdb", when i start up mongo.exe on another shell, i get a connection error

MongoDB shell version: 3.2.9 connecting to: test 2016-10-01T17:20:11.543+0300 W NETWORK [thread1] Failed to connect to 127.0.0.1:27017 after 5000 milliseconds, giving up. 2016-10-01T17:20:11.543+0300 E QUERY [thread1] Error: couldn't connect to server 127.0.0.1:27017, connection attempt failed : connect@src/mongo/shell/mongo.js:229:14 @(connect):1:6 exception: connect failed

what is it that i'm not doing right? Running it on Windows 10. Mongod.exe after set up waits for a connection.

Upvotes: 0

Views: 780

Answers (2)

Ping Woo
Ping Woo

Reputation: 1773

This is because the db server must be running and waiting for connections. I think you should start your db server first with ./mongod in the root directory and leave it running. Hopefully this will help!

Upvotes: -1

Muhamad Eissa
Muhamad Eissa

Reputation: 77

it is may be because of the OS privileges so for example if you are in windows try to open the cmd(command line) in administrator mode and try to start the MongoDB server again,i hope this fix your problem

Upvotes: 0

Related Questions