2019-05-21T14:25:54.799+0300 I CONTROL [initandlisten] options: {}
2019-05-21T14:25:54.800+0300 I STORAGE [initandlisten] exception in initAndListen: NonExistentPath: Data directory /data/db not found., terminating
2019-05-21T14:25:54.800+0300 I NETWORK [initandlisten] shutdown: going to close listening sockets...
2019-05-21T14:25:54.800+0300 I NETWORK [initandlisten] removing socket file: /tmp/mongodb-27017.sock
2019-05-21T14:25:54.800+0300 I CONTROL [initandlisten] now exiting
2019-05-21T14:25:54.800+0300 I CONTROL [initandlisten] shutting down with code:100
How do I figure out about Data directory /data/db not found., terminating
I ran into this same issue a few days ago. I am using Mac OS. Apparently, there was a permission problem with having my data directory in the root of my home folder. So what i did was i just created a directory in a folder in a location where i definitely have permissions and then ran mongo db with the the --dbpath option set to that location. for example:
mongod --dbpath ~/documents/data/db
Hope this helps :D
The problem is that by default, Mongo points to that /data/db folder, and it either forgets to create or set ownership of it on installation.
sudo mkdir -p /data/db/
And then, we’ll set the ownership of the folder to the user that’s going to start the mongod service. Since I only use if for local development in my computer, I set myself as the owner:
sudo chown `id -u` /data/db
Now, just running mongod should do the job. Hope that helps you!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With