I am new to mongo
, and I am trying to install mongo on my windows system. I am following THIS tutorial, but when I do
C:\mongodb\bin\mongod.exe
my CMD
gives me this output
2015-04-20T18:53:27.433+0500 I STORAGE [initandlisten] exception in ini
en: 29 Data directory C:\data\db\ not found., terminating
2015-04-20T18:53:27.436+0500 I CONTROL [initandlisten] dbexit: rc: 100
MongoDB requires a data directory to store all data. MongoDB’s default data directory path is \data\db
.
Create this folder
md \data\db
You can specify an alternate path for data files using the --dbpath
option to mongod.exe, for example:
C:\mongodb\bin\mongod.exe --dbpath d:\test\mongodb\data
If your path includes spaces, enclose the entire path in double quotes,
for example:
C:\mongodb\bin\mongod.exe --dbpath "d:\test\mongo db data"
Read more in detail
I fixed the same using :
Create a folder data in
D:\project-workspace\mongodb\data
Then Create another folder db inside data ie,
D:\project-workspace\mongodb\data\db
Then run the command
mongod --dbpath D:\project-workspace\mongodb\data\db
Make sure you have set environment variable for mongodb else browse
C:\Program Files\MongoDB\Server\3.4\binand then execute this =>
mongod.exe --dbpath E:\workspace\mongodb\data
Also faced the same issue in windows. if --dbpath directory path does not contain spaces, do not include quotes. Removing quotes, when the path does not have space, resolved the issue.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With