• Register
0 votes
1.1k 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

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
2 answers 123 views
123 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 586 views
586 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 17 views
17 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 Jul 29 Raphael Pacheco 4.9k points
0 votes
1 answer 9 views
9 views
I'm a newbie when it comes to Linux administration using bash... I was following a tutorial on how to install laravel 5.2 from here... installed it successfully... firstly I installed composer and ran the following command composer global require "laravel/installer" after this put ... the path Note: I have installed oh my zsh on my terminal... What do I have to do to get it working please help
asked Sep 13 Marivoke 530 points
1 vote
1 answer 12 views
12 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 Aug 1 adamSw 11.3k points