In this MongoDB tutorial, let us see how to fix the error, “MongoDB shutting down with code 100“. We will also see the root cause of the issue.
Why shutting down with code 100 in MongoDB
While starting MongoDB, I recently got an error like “MongoDB shutting down with code 100“. It looks like below:

Basically, this problem occurred due to a permission issue with the data files or it is not finding the desired location of the file.
Also Read: How to install MongoDB
Solution: MongoDB shutting down with code 100
Now, let us see how to fix the Windows OS, macOS, and Ubuntu errors.
Windows
For Windows users to resolve this issue follow the below solution.
Sometimes when we start the MongoDB server, we got an error shutting down with code 100.
So, what causes it to exit with code 100?
One of the main reasons for the exit with code 100 is
- Incorrect file permission
- Missing database directory
Sometimes folder already exists in the system due to the previous installation. So if this is the reason for getting the error we need to delete all the content from the folder and then start the MongoDB server. This will resolve the problem.
macOS
For macOS users to resolve this issue use the following steps
- We need to create the “db” directory. Because mongo data files will store in this directory.
- We can create the diretory in the using this command
sudo mkdir -p /data/db
- we also have to provides right permission to the directory
sudo chown -R 'id -un' /data/db
- Now with the help of “sudo mongod” command we can succesfully start the mongo server.
- Note that it will not gonna work if you only use “mongod“.
Ubuntu
For Ubuntu users to resolve this issue
This error shutting down with code 100 has occurred mainly due to a permission issue with the data files so to resolve this error we need to change the ownership to the MongoDB user,
sudo chown -R mongodb:mongodb /var/lib/mongodb
After running the command this will change the ownership and resolve the existing error of MongoDB. Now, we can successfully run the MongoDB server.
In this tutorial, we learned how to fix shutting down with code 100 in MongoDB.
Also, Read: Unable to locate package mongodb-org
I am Bijay having more than 15 years of experience in the Software Industry. During this time, I have worked on MariaDB and used it in a lot of projects. Most of our readers are from the United States, Canada, United Kingdom, Australia, New Zealand, etc.
Want to learn MariaDB? Check out all the articles and tutorials that I wrote on MariaDB. Also, I am a Microsoft MVP.