Can't start mongodb service
Just a simple reinstall worked.
sudo apt purge mongodb-org*
sudo rm -r /var/log/mongodb
sudo rm -r /var/lib/mongodb
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv EA312927
echo "deb http://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/3.2 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.2.list
sudo apt update
sudo apt-get install -y mongodb-org
and double-check the config file:
sudo nano /etc/systemd/system/mongodb.service
paste this:
[Unit]
Description=High-performance, schema-free document-oriented >database
After=network.target
[Service]
User=mongodb
ExecStart=/usr/bin/mongod --quiet --config /etc/mongod.conf
[Install]
WantedBy=multi-user.target
finally
sudo systemctl start mongodb
sudo systemctl enable mongodb
also I think I changed the permissions of the log file to 777
This Worked for me.
sudo chown -R mongodb:mongodb /var/lib/mongodb
sudo chown mongodb:mongodb /tmp/mongodb-27017.sock
I am using Linux Mint 20.
chown -R mongodb:mongodb /var/lib/mongodb
chown mongodb:mongodb /tmp/mongodb-27017.sock
sudo systemctl restart mongod
sudo systemctl status mongod
these permission commands work for me on ubuntu 20.04