9

How do I set mongo db dbpath on windows 7? I created a directory in my my C drive as data/db but it is not working.

Shreyash
  • 367
  • 1
  • 3
  • 11

3 Answers3

21

The mongodb data dir is not application specific. It is mongod.exe process specific.

As documentation says

By default MongoDB will store data in \data\db, but it won't automatically create that folder, so we do so here:

C:\> mkdir \data
C:\> mkdir \data\db Or you can do this from the Windows Explorer, of course.

If you prefer to place datafiles elsewhere, use the --dbpath command line parameter when starting mongod.exe.

This means that you need to create C:\data\db directory or start mongod.exe with the full path to your data dir as --dbpath parameter value.

ryanhex53
  • 577
  • 4
  • 15
lig
  • 3,567
  • 1
  • 24
  • 36
  • 2
    I am new to mongo and trying to also install for the first time. I am still getting error after creating that folder. – user982853 Jan 17 '12 at 02:34
  • @user52045 it is possible to configure windows service https://docs.mongodb.org/v3.0/tutorial/install-mongodb-on-windows/#configure-a-windows-service-for-mongodb and use a config file with all the settings you need. – lig Dec 24 '15 at 14:00
5

Additionally add

C:\Program Files\MongoDB\Server\3.0\bin;

to your Path variable.

Michael Brenndoerfer
  • 3,483
  • 2
  • 39
  • 50
1

--> in the path of windows paste url install for example: C:/mongodb/bin
-->here mongod.exe and mongo.exe

add C:/mongodb/bin

open cmd, write: mongod open other cmd,write mongo

enjoy :)

PD: It's the same for other python, ruby etc. Windows is hurts T_T haha

joelengt
  • 9
  • 1