Where is mongo database folder on the filesystem
I'm using Ubuntu 16.04. I have set up a database MongoDB. When I start it (with mongod command) it says that database is located at /data/db (dbpath=/data/db).
The database works fine. But in files explorer I cannot find that folder. I've looked in Computer folder and in Home (Computer/home/<my name>) folder.
I also showed hidden files and folders with Ctrl+H.
How can I find my database folder?
4 Answers
You should be able to find the location in the configuration file: /etc/mongod.conf
grep -i dbPath /etc/mongod.confAccording to mongodb docs:
The default path is /data/db directory
By default, MongoDB listens for connections from clients on port 27017, and stores data in the /data/db directory.
If dbPath is set, the mongodb will use the directory specify by dbPath
5If you want
mongodto store data files at a path other than/data/dbyou can specify adbPath. ThedbPathmust exist before you startmongod. If it does not exist, create the directory and the permissions so thatmongodcan read and write data to this path. For more information on permissions, see the security operations documentation.
When using linux (Ubuntu), when you install mongodb, it is automatically configured and run by default. The default dbpath is located in mongodb.conf. You should see the following lines:
# Where to store the data dbpath=/var/lib/mongodbNow, based on mongodb doc:
The default path is[should be]
/data/dbdirectory, but if the folder isn't present, mongodb will fire from the path given in the mongodb.conf file.
What to do:
- stop your mongodb.
- create your default data folder.
- restart mongodb: this time it will start from the data folder you created.
Try typing file:///data/db/ in the browser (chrome or fire-fox). You'll be able to see the files and collections if you have mongodb installed in system, but all would be encrypted you cannot read them in an editor.
That's because the "root" that you are seeing, is not the real root, its the root of your home, on the File explorer, when you are on your 'root' home page, press backspace to go to the parent folder.