How to solve the “Failed to unlink socket file” error in MongoDB
So I discovered that my Node application learnresponsiveimages.com suddenly had stopped working.
After at bit of research, it seemed like it actually was my MongoDB server that had stopped working. It just wasn’t running anymore.
I ran sudo service mongod status
and got this, not very helpful message:
So I checked the /var/log/mongodb/mongod.log
file and found this error:
Failed to unlink socket file /tmp/mongodb-27017.sock errno:1 Operation not permitted
The solution was to simply delete that file.
rm /tmp/mongodb-27017.sock
Problem solved and sudo service mongod start
made it work again ✌🏻