Exception in initAndListen: 29 Data directory /data/db not found

Cannot start mongod due to error:
exception in initAndListen: 29 Data directory /data/db not found., terminating

Directories specified in the config file must exist before starting mongod.

Where do I create this folder?

@Joao_62802, it is very hard to answer this question without being rude. This course is an advanced security course. At this point you really really should be able to create a directory named /data/db. Anyway here it is:

mkdir /data/db

The question is how come these folders aren’t created by Vagrant? :face_with_raised_eyebrow:


For security reasons, I guess. I would not want a process to go around and create directories all over the place. You also want directories to be created with certain attributes, like owner, group and permissions.

this commands will help:
sudo mkdir -p /data/db
sudo chown vagrant:vagrant -R /data/db
then you can run server with default parameters


You are answering to a thread that is 27 days old.