Error message : Failed to unlink socket file /tmp/mongodb-27017.sock Operation not permitted
.
-
Remove
mongodb-27017.sock
and reload mongod.$ sudo rm -rf /tmp/mongodb-27017.sock $ ls -lsah /tmp/mongodb-27017.sock $ sudo systemctl restart mongod
and/or if that doesn't work you can do as below.
-
Add owner to mongodb-27017.sock.
$ sudo chown -R $USER /tmp/mongodb-27017.sock $ sudo systemctl restart mongod
and/or if that doesn't work you can do as below.
-
Run mongod with sudo.
$ sudo mongod
Error message : exception in initAndListen: IllegalOperation: Attempted to create a lock file on a read-only directory: /data/db, terminating
.
-
Create folder
/data/db
and add owner.$ sudo mkdir /data/db $ sudo chown -R $USER /data/db $ sudo systemctl restart mongod