📜  非法操作:试图在只读目录上创建锁定文件:data db,终止 - 无论代码示例

📅  最后修改于: 2022-03-11 14:55:59.143000             🧑  作者: Mango

代码示例1
From the question description it appears you are running mongod from your own account (user: makan).

Your invocation of mongod without specifying a configuration file or --dbpath would require this user to have read/write permissions for the default dbpath directory (/data/db). Since /data/db is only writable by user mongodb, a permission error is expected when mongod tries to write a file running with the permissions of makan: