I want to change auth=false to auth=true in mongod.conf file in ubuntu but not able to find mongod.conf file in /etc/. So which are the other possible locations for finding this file.
By default, mongod sets the database location to /data/db/. For checking by yourself you should run ps -xa | grep mongod and if you don't see a --dbpath which explicitly tells mongod to look at that parameter for the db location and you don't have a dbpath in your mongodb.
dbPath is /var/lib/mongodb; this setting specifies where MongoDB should store its files.
Finding your mongod config path using mongo shell:
db.adminCommand('getCmdLineOpts');
It returns all command line options. Just for config path:
db.adminCommand('getCmdLineOpts').parsed.config;
Reference: https://docs.mongodb.org/manual/reference/command/getCmdLineOpts/
--
You can create manually. Path: /etc/mongod.conf
Also take a look https://docs.mongodb.org/v3.0/reference/configuration-options/#use-the-configuration-file
In my case Ubuntu 18.04: /etc/mongodb.conf
Still got this in 2020. reinstalling all mongodb-related packages solved it for me
apt purge mongo*
apt install mongodb
Note that simply reinstalling just mongodb package doesn't fix it.
In a terminal run sudo find / -name mongodb.conf
(I'm aware that the OP looks for mongod.conf
, not sure if this is a typo? No such file on my system...)
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