xxxxxxxxxx
# MongoDB.service failed with result exit-code
# check permissions below directories using cmd:
ls -l
# directories checklist:
/var/lib/mongodb
/var/log/mongodb
/tmp/mongodb-27017.sock
# Above directories must have prmsn mongodb:mongodb if not below cmd:
chown -R mongodb:mongodb
#(-R) for recursive dir, if file remove it
# if all have same permission then its good
sudo service mongod start
# if not same then remove it ...
sudo rm -rf /file_or_folder_name/
### start with below comands
sudo service mongod start
sudo service mongod status
xxxxxxxxxx
$ sudo rm -rf /tmp/mongodb-27017.sock
$ sudo service mongod start
xxxxxxxxxx
chown -R mongodb:mongodb /var/lib/mongodb
chown mongodb:mongodb /tmp/mongodb-27017.sock
xxxxxxxxxx
This will worked for you and don't reinstall MongoDB.
```
sudo mkdir /var/lib/mongodb
sudo mkdir /var/log/mongodb
```
then run these commands
```
sudo chown -R mongodb:mongodb /var/lib/mongodb
sudo chown -R mongodb:mongodb /var/log/mongodb
```
start mongod service
```
sudo service mongod start
```
mongod.service will be active
```
sudo service mongod status
```
xxxxxxxxxx
chown -R mongodb:mongodb /var/lib/mongodb
chown mongodb:mongodb /tmp/mongodb-27017.sock
xxxxxxxxxx
sudo chown -R mongodb:mongodb /var/lib/mongodb
sudo chown mongodb:mongodb /tmp/mongodb-27017.sock