• Register
0 votes
1.5k 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 5 3
6,930 points

Please log in or register to answer this question.

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.

9 7 4
38,600 points
my mongod.conf says:  dbPath: /var/lib/mongodb

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

Related questions

0 votes
1 answer 9 views
9 views
Problem: I got following message : exception in initandlisten: nonexistentpath: data directory /data/db not found., terminating Any help!!
asked Mar 14 Wafa Abu Yousef 6.1k points
0 votes
2 answers 166 views
166 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, 2020 alecxe 7.5k points
0 votes
1 answer 4 views
4 views
Problem: 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 ... +0300 I CONTROL [initandlisten] shutting down with code:100 How do I figure out about Data directory /data/db not found., terminating
asked 1 day ago ochena 22.1k points
0 votes
1 answer 4 views
4 views
Problem: I download and install the last vesrion of MongoDb which is 4.0.2 and i set the correct path variable. When i want to start the mondoDb service using mongod command i got the following error: exception in initAndListen: NonExistentPath: Data directory C:\data\db\ ... Files\MongoDB\Server\4.0\data Now how to tell the mongo to look for the folder he thinks is missing in the correct path ?
asked Apr 26 Moumita Bhowmick 12.4k points
0 votes
1 answer 4 views
4 views
Problem: Please help me to solve it... data directory /data/db not found., terminating
asked Mar 31 Ifra 34.7k points
0 votes
1 answer 17 views
17 views
Problem: Have anybody faced this error? any clues to fix this error: Attempted to create a lock file on a read-only directory: /data/db, terminating
asked Mar 14 Wafa Abu Yousef 6.1k points
0 votes
1 answer 1.6K views
1.6K 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, 2020 alecxe 7.5k points
0 votes
1 answer 1 view
1 view
Problem: Please assist me in resolving this issue: Could not get lock /var/lib/dpkg/lock-frontend - open (11: resource temporarily unavailable).
asked Mar 30 tuhin1 48.9k points
0 votes
1 answer 4 views
4 views
Problem: Do you know how to read a database file (.db)?
asked Apr 17 padma1 34.3k points