Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

cant start mongo db , initandlisten exception

Tags:

mongodb

I try to start mongodb with mongod. This is my error message:

I STORAGE [initandlisten] exception in initAndListen: 29 Data directory /data/db not found., terminating

So I tried to start it from my mongodb folder ( which has a folder with data , and this one has db in it) and still doesnt work. It got the same error message.

like image 380
nova Avatar asked Mar 22 '26 04:03

nova


1 Answers

MongoDB requires a data directory to store all data. MongoDB’s default data directory path is the absolute path \data\db on the drive from which you start MongoDB. Create this folder by running the following command in 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:\Program Files\MongoDB\Server\3.4\bin\mongod.exe" --dbpath d:\test\mongodb\data

If you are working on windows then for me the best link to follow is

https://docs.mongodb.com/manual/tutorial/install-mongodb-on-windows/

and same for Linux and OS X given inside Installation category within this link.

like image 121
Vicky Avatar answered Mar 24 '26 17:03

Vicky