How to uninstall mongodb from Windows
Asked Answered
S

7

11

I saw a tutorial that said to run this:

C:\mongodb\bin\mongod.exe --config C:\mongodb\mongod.conf --remove

but that command does not work since there is no mongod.conf file in the mongodb folder in my Windows. Besides, I don't want to only stop the service, but to remove everythin, including files, services, etc. Is that possible?

I am using Windows 8.1.

Spancel answered 4/8, 2017 at 1:48 Comment(3)
Well if you installed from an .msi ( which was the recommended approach ) then you should simply be able to uninstall like any other program. May possibly leave data directories behind, but I presume you know how to delete files? If you did not install from an .msi then delete the directory. The install process does not actually "install a service" by itself, and required a manual step. See Install MongoDB On Windows in the core documentation.Sheree
you can create a basic mongod.conf with minimum information like path to files and logs. As for removing the installed service, totally agreed that you can use window uninstall program feature.Oblivious
Hi, thanks, well, I have not found the uninstalled option, I dont remember how I have installed it, so, now I have only stoped the service, and removed all the folder C:\mongodbSpancel
T
21

The command...

C:\MongoDB\bin\mongod.exe --config C:\MongoDB\mongod.conf --remove

Is used to just remove the service.

If you don't have a mongod.conf and/or no longer have the .msi installer (who keeps that stuff?) then:

  1. win-key + r and run regedit
  2. Navigate to Computer\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\MongoDB (or just cut and paste this path)
  3. Once there right click on MongoDb and click Delete. Service is now gone.
  4. Goto C:\mongodb (or where you installed it) and delete directory. Mongodb is now gone.

Check your system environment variables to see if it's in your path (It will not exist unless you put it there).

Alternatively you may be able to re-download the msi and try using that.

EDIT: If you forgot to stop the service first or if it left dead orphan in services then open CMD or other shell as administrator and run the command: sc.exe delete MongoDB ... you should see: [SC] DeleteService SUCCESS

Townley answered 19/10, 2017 at 21:38 Comment(4)
Doing none of this will remove MongoDB from services.Mutation
getting access denied for all, how to solve it. not able to run mongod also. getting message Access is denied from cmd windows 10.Form
If your are getting an access denied message then most likely you did not run CMD or other shell as administrator. The process is very simple... 1) stop then remove the service. 2) delete the directory where MongoDB lives. 3) remove reference from your environment variable path if you manually added it there. I don't keep old .msi installers, if you did, it may have an option to remove. If you go the msi route then I would check that it removed the service and not just stopped it.Townley
if mongod is configured correctly there's no need to specify the config, just --remove to remove the serviceEpochmaking
P
9

Use the command below to delete the service:

  • run cmd as Administrator
  • sc delete MongoDB
Peculium answered 24/5, 2018 at 8:2 Comment(2)
getting access is denied in cmdForm
run cmd as AdministratorSudderth
R
8

Since you're using Windows, just run the same .msi file that you installed it with.

It should be in your downloads folder, i'm guessing.

Once you opened the file, press next and there you will have the complete access to remove your MongoDB installation.

Requisite answered 23/8, 2017 at 10:15 Comment(0)
D
1
  1. Run the mongo-db installation file that ends with .msi.
  2. You'll see the remove option there, click on it.
  3. Then you could delete the mongo-db files that are in your computer.
Danelaw answered 28/5, 2020 at 14:28 Comment(0)
M
0
  1. Go to services.msc and stop MongoDb service .

  2. Delete all the folders in C: drive where MongoDb Folders exists. Remove data folder if you created previously.

  3. Type cmd in start and ryt click on cmd and select run as

administrator and type below Command. sc delete MongoDB If it throws some error like service not exists then open properties of the service and check whether you are giving the proper service name.

Motivity answered 14/9, 2018 at 3:59 Comment(0)
F
0

net stop MongoDB : This will stop your mongo server(in case of windows) then simply delete that MongoDb folder.

Fons answered 23/10, 2021 at 16:33 Comment(0)
I
0

Reusing older posts to not reinvent the wheel...

Removing the MongoDB service

1: The command...

C:\MongoDB\bin\mongod.exe --config C:\MongoDB\mongod.conf --remove

Is used to just remove the service.
NB: the configuration file may have the suffix .cfg.

2: Or you can use the Windows general way with:

sc delete MongoDB

Removing the MongoDB installation

NB: if you delete the MongoDB directory on the disk, you will still see MongoDB in the list of installed programs.

You can uninstall MongoDB automatically using a script doing something like this:

  1. Find the package Id:

In Powershell, do:

Get-Package -Name 'MongoDB package name' | fl TagId

The 'MongoDB package name' is the name you can see in the control panel / Programs and features.

  1. Use this Id to uninstall the MongoDB package automatically:

msiexec /x {TagId}

Replace the TagID string with the Id you find before.
Keep the {}.

Impalpable answered 5/4, 2023 at 16:48 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.