For AI agents: a documentation index is available at https://www.mongodb.com/docs/llms.txt — markdown versions of all pages are available by appending .md to any URL path.
Docs Menu

Uninstall MongoDB from Linux

If you installed MongoDB Enterprise or MongoDB Community on Linux with a package manager, you can uninstall it through the package manager. To completely remove MongoDB, you must also remove the MongoDB applications, the configuration files, and any directories containing MongoDB data and logs.

Warning

This process completely removes MongoDB, its configuration, and all databases. Because this process is not reversible, ensure that all of your configuration and data are backed up before proceeding.

Select your distribution to view instructions for uninstalling MongoDB:

1

Stop the mongod process by issuing the following command:

sudo systemctl stop mongod
2

Remove any MongoDB packages that you previously installed.

sudo yum erase $(rpm -qa | grep mongodb-enterprise)
3

Remove MongoDB databases and log files.

sudo rm -r /var/log/mongodb
sudo rm -r /var/lib/mongo
4

Remove the MongoDB configuration file.

sudo rm /etc/mongod.conf
1

Stop the mongod process by issuing the following command:

sudo systemctl stop mongod
2

Remove any MongoDB packages that you previously installed.

sudo apt purge mongodb-enterprise*
3

Remove MongoDB databases and log files.

sudo rm -r /var/log/mongodb
sudo rm -r /var/lib/mongodb
4

Remove the MongoDB configuration file.

sudo rm /etc/mongod.conf
1

Stop the mongod process by issuing the following command:

sudo systemctl stop mongod
2

Remove any MongoDB packages that you previously installed.

sudo apt purge mongodb-enterprise*
3

Remove MongoDB databases and log files.

sudo rm -r /var/log/mongodb
sudo rm -r /var/lib/mongodb
4

Remove the MongoDB configuration file.

sudo rm /etc/mongod.conf
1

Stop the mongod process by issuing the following command:

sudo systemctl stop mongod
2

Remove any MongoDB packages that you previously installed.

sudo zypper remove $(rpm -qa | grep mongodb-enterprise)
3

Remove MongoDB databases and log files.

sudo rm -r /var/log/mongodb
sudo rm -r /var/lib/mongo
4

Remove the MongoDB configuration file.

sudo rm /etc/mongod.conf
1

Stop the mongod process by issuing the following command:

sudo systemctl stop mongod
2

Remove any MongoDB packages that you previously installed.

sudo yum erase $(sudo rpm -qa | grep mongodb-enterprise)
3

Remove MongoDB databases and log files.

sudo rm -r /var/log/mongodb
sudo rm -r /var/lib/mongo
4

Remove the MongoDB configuration file.

sudo rm /etc/mongod.conf