I am new to Ubuntu (Linux tbh). I encountered problem with starting MongoDB service. I want to created web app using Ruby on Rails and MongoDB but mongo seems to fail to sta
For me, it was because of the bad data inside the folder: ‘/data/db’
Solution that worked for me: Remove all the files inside '/data/db'
SOLUTION by kometen
Does the file /tmp/mongodb-27017.sock exist? If so try to delete it, ie. 'sudo rm /tmp/mongodb-27017.sock'.
mongo --shell
It worked for me on ubuntu
If you use Ubuntu, try:
sudo mongod
The problem can also be due to mongodb using up all the disk space. That was the case for me. You can install ncdu with this command: sudo apt install ncdu
This will help you in looking at the disk usage. Use the command: ncdu -x /
Remove the unwanted dbs from /var/lib/mongodb/
sudo mongod
(suggested by @João Bortolosso)
after (suggested by @fresz):
sudo rm /tmp/mongodb-27017.sock
worked on mac!