How to solve `Failed to unlink socket file /tmp/mongodb-27017.sock Operation not permitted` in MongoDB
Solution for `Failed to unlink socket file /tmp/mongodb-27017.sock Operation not permitted` error n MongoDB and Linux.
Well I'm pretty sure if you have installed MongoDb from .deb
files you may have ran into this error:
Failed to unlink socket file /tmp/mongodb-27017.sock Operation not permitted
I really dont want to dive into the why's so here's the solution:
# Stop MongoDB
service mongod stop
# Delete the famous socket causing the problem!
rm -fr /tmp/mongodb-27017.sock
# Start MongoDB
service mongod start
# Connect to your localhost
mongo 127.0.0.1:27017
If everything went well you should see MongoDB's console ready to be used.