我想把mongod.conf文件中的auth=false改为auth=true,但在ubuntu的/etc/目录下找不到mongod.conf文件。那么其他可能的位置在哪里。
我想把mongod.conf文件中的auth=false改为auth=true,但在ubuntu的/etc/目录下找不到mongod.conf文件。那么其他可能的位置在哪里。
使用mongo shell查找mongod配置文件路径:
db.adminCommand('getCmdLineOpts');
db.adminCommand('getCmdLineOpts').parsed.config;
参考:https://docs.mongodb.org/manual/reference/command/getCmdLineOpts/
--
您可以手动创建。路径:/etc/mongod.conf
另请参阅:https://docs.mongodb.org/v3.0/reference/configuration-options/#use-the-configuration-file
在我的情况下,Ubuntu 18.04: /etc/mongodb.conf
2020年仍然存在此问题。重新安装所有与MongoDB相关的软件包解决了我的问题。
apt purge mongo*
apt install mongodb
请注意,仅重新安装mongodb程序包并不能解决这个问题。
sudo find / -name mongodb.conf
(我知道OP正在寻找mongod.conf
,不确定这是否是打字错误?我的系统上没有这样的文件...)mongod.conf
,但实际上是mongodb.conf
。https://docs.mongodb.com/manual/reference/configuration-options/ - JustAMartin