• Register
0 votes
942 views

Problem :

When I tried to run Mongodb in terminal I got following message :
exception in initandlisten: nonexistentpath: data directory /data/db not found., terminating
6.9k points

1 Answer

0 votes

Solution :

Please note MongoDB needs data directory to store data. Default path is as follows:

 /data/db

When you try to start MongoDB engine it generaly searches this directory which must be missing in your case. So the smple Solution is to create this directory and assign the rwx permission to user.

If you want to update the path of your data directory then you must specify it while starting mongod server like as follows

mongod --dbpath /data/<path> --port <port no> 

This change will help you to start your mongod server with custom path and port.

36.1k points
my mongod.conf says:  dbPath: /var/lib/mongodb

so, why is it still looking for /data/db ?

Related questions

0 votes
2 answers 106 views
106 views
Problem : When I was trying to run the Mongod in terminal I got below message : 2020-01-14T17:33:04.554+0700 I STORAGE [initandlisten] exception in initAndListen: 29 Data directory /data/db not found., terminating 2020-01-14T17:33:04.554+0700 I CONTROL [initandlisten] dbexit ... src/mongo/shell/mongo.js:179 exception: connect failed I am using the Ubuntu 14.04 LTS 64 bit. How can I fix this issue?
asked Jan 10 alecxe 7.5k points
0 votes
1 answer 232 views
232 views
Problem : I had created /data/db in my root directory and ran ./mongod but getting below error : [initandlisten] exception in initAndListen: 20 Attempted to create a lock file on a read-only directory: /data/db, terminating [initandlisten] shutdown: going to ... .. [initandlisten] now exiting [initandlisten] shutting down with code:100 Have anybody faced above error? any clues to fix above error?
asked Jan 4 alecxe 7.5k points
0 votes
1 answer 4 views
4 views
Problem: I am the beginner to MongoDB. I had followed all the steps which are mention in MongoDB installation documents for the Ubuntu 16.04. I executed the following command: sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv ... when I started my MongoDB then encountered an error as below: Failed to start mongod.service: Unit mongod.service not found.
asked 5 days ago Raphael Pacheco 2.3k points
1 vote
1 answer 4 views
4 views
Problem: Hello Kodlogs, I am a Linux user and currently running Ubuntu 18.04 LTS distribution on my machine. I&rsquo;ve written a sample python program and trying to execute it through the Linux terminal. My sample program is saved as samle.py and I put a command ... command not found Why this is happening? Could you please give a hint? How could I overcome the error? Thanks for enlightening me.
asked 2 days ago adamSw 10.9k points
1 vote
1 answer 31 views
31 views
Problem: I want to install one package named speech_tools-2.1-release.tar.gz. After I run the command ./configure in this package, it shows me a message:\ Configure: error: no acceptable C compiler found in $PATH See 'config.log' for more details Any solution would be much appreciated. Thanks.
asked Mar 10 Gavin 15.2k points