Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MongoDB window closes automatically when I try to open

I'm trying to install MangoDB in my windows machine 64-bit. I'm following official documentation to install the same. I have installed successfully as stated and stuck at Run MongoDB section at step 2.

http://docs.mongodb.org/manual/tutorial/install-mongodb-on-windows/

When I run the file "C:\Program Files\MongoDB\bin\mongod.exe" window opens and automatically closes. Not sure why this is happening, I Googled and tried troubleshooting the same but no luck. I even added MongoDB path to windows environment variables as well. But still it doesn't work.

Anyone faced this issue? Any suggestions would be helpful.

Thanks!

like image 411
user3882418 Avatar asked Aug 18 '14 03:08

user3882418


People also ask

Why is my MongoDB shutting down?

the MongoDB shutting down with code:100 Error Due to Incorrect File Permissions. One main reason for this error is incorrect file permissions. This problem occurred due to either a permission issue with the data files or the inability to find the desired file location.

Does MongoDB support Windows 10?

Platform Support MongoDB 6.0 Community Edition supports the following 64-bit versions of Windows on x86_64 architecture: Windows Server 2019. Windows 10 / Windows Server 2016.


2 Answers

from doc:

MongoDB requires a data directory to store all data. MongoDB’s default data directory path is \data\db. Create this folder using the following commands from a Command Prompt:

md \data\db

You can specify an alternate path for data files using the --dbpath option to mongod.exe, for example:

C:\mongodb\bin\mongod.exe --dbpath d:\test\mongodb\data

The reason of your problem is that you don't have that data directory.

like image 161
laike9m Avatar answered Sep 28 '22 06:09

laike9m


Create a folder named 'data' with sub-folder 'db' in the root of the folder where your MongoDB Server is installed.

Like in my case, it was installed on C:/Program Files/MongoDB/ and the mongod.exe, mongo.exe resides in C:/Program Files/MongoDB/Server/4.0/bin/.

So, I created a folder namely "data" and a sub-folder in it namely "db".

C:/data/db

Sometimes, there might be a chance that "data" folder already exists in the root drive. Then, just create a sub-folder named "db" in it.

After all of this, close mongod.exe & mongo.exe if running. And open them again in order to see if the problem is gone! I hope that solves the problem.

like image 34
ChaiVan Avatar answered Sep 28 '22 07:09

ChaiVan