0

After installing mongodb on windows, I set up the necessary folders but made a typing mistake when doing the following command:

mongod --directoryperdb --dbpath C:\mondodb\data\db --logpath C:\mongodb\log\mongo.log --logappend --rest --install

the folder is named mongodb but i named it mondodb by accident and can't seem to overwrite that, so when I start mongodb by doing net start mongodb I get an error in my log saying C:\mondodb\data\db not found

I tried redoing it like so mongod --directoryperdb --dbpath C:\mongodb\data\db --logpath C:\mongodb\log\mongo.log --logappend --rest --install but it's not working.

how can I redo the mongod thingy?

1 Answer 1

0

There are a few different things you could try:

  • Go into the registry and change the service path: Modifying the "Path to executable" of a windows service. After you modify it, you can go into Services.msc, right-click on the service, go to Properties, then Look at the Path to executable: and make sure that it points to mongodb rather than mondodb.

    It involves editing the registry, but service information can be found in HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services. Find the service you want to redirect, locate the ImagePath subkey and change that value.

  • Go into a command prompt (may need to Run as Administrator) and do sc delete mongod <or whatever the service is named> -- can check services.msc for that). Then re-run your command with the correct path.

  • Alternately, you might try to set it up by taking a config file so that you can just change those options via config file rather than having to modify the service or delete/reinstall the service when you want to change options. I believe the command there is C:\<mongopath>\mongod.exe -f <config file name> --install.
Sign up to request clarification or add additional context in comments.

1 Comment

No. 2 worked for me, i already made a new folder called "mongo" and copied relevant files but could not re-install due to it existing already, so sc delete mongod fixed it. thanks!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.