Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Windows could not start mongodb service on local computer. For more info., review the System Event Log

I am using Windows 32-bit machine and tried to start MongoDB service from Windows > services as shown below.

enter image description here

However, I am unable to start the MongoDB service from it and throws the following error.

enter image description here

When I try using cmd prompt, I am getting the following error:

Network Failed to connect to 127.0.0.1:27017, reason: errno:10061 No connection could be made because the target machine actively refused it.

Error: Couldn't connect to server 127.0.0.1:27017 <127.0.0.1>, connection attempt failed.

enter image description here

like image 902
Prashanth Sams Avatar asked Jul 12 '15 07:07

Prashanth Sams


People also ask

Why Mongodb is not opening?

We found that the reason for this error was the dbpath variable in /etc/mongodb. conf. Previously, the default value for dbpath was /data/db. The upstart job mongodb(which comes with mongodb-10gen package) invokes the mongod with –config /etc/mongodb.

How does Python connect to Mongodb?

The first step to connect python to Atlas is MongoDB cluster setup. Next, create a file named pymongo_test_insert.py in any folder to write pymongo code. You can use any simple text editor like Textpad/Notepad. Use the connection_string to create the mongoclient and get the MongoDB database connection.


Video Answer


2 Answers

I had same an issue.

Try to remove mongod.lock file from your Mongo data directory.

For example mine is "C:\Program Files\MongoDB\Data\mongod.lock" and after deleting file start the MongoDB service and it's work like charm.

like image 95
Yogesh Patel Avatar answered Sep 18 '22 08:09

Yogesh Patel


So I just had the same problem, running on Windows 10. The reason why MongoDB didn't start was because the path to the data and logs was not correctly set. This has already been pointed out, but my solution is different. Look in C:\Program Files\MongoDB\Server\4.0\bin (or wherever your mongoDB is installed). There is a config file called mongod.cfg. Check that

storage:
  dbPath:

and

systemLog:
  path:  

Is set to what you want. In my case, it was using environment variables %MONGODBPATH% or similar that was not set by Windows. By default, the log and data should point to C:\Program Files\MongoDB\Server\4.0\data and C:\Program Files\MongoDB\Server\4.0\log\mongod.log respectively.

like image 35
Zorobay Avatar answered Sep 17 '22 08:09

Zorobay