Reputation: 6093
I just installed a new MongoDB 3.6 on my Windows machine. Now I'm trying to change the default DB path. So I tried this:
"C:\Program Files\MongoDB\Server\3.6\bin\mongod.exe" --dbpath c:\mongodb\data
It worked, but only until I restarted Mongo. Then it was back to usual c:\data\db
.
I tried to google it, saw some info about changing a mongod.conf file, but I can't find this file in my installation.
Any suggestions?
Upvotes: 2
Views: 7141
Reputation: 41
Save this script in a Batch File(Mongo.bat) and run it every time:
"C:\Program Files\MongoDB\Server\3.6\bin\mongod.exe" --dbpath c:\mongodb\data
Upvotes: 4
Reputation: 2447
You need to start mongod with same command everytime:
C:\Program Files\MongoDB\Server\3.6\bin\mongod.exe" --dbpath c:\mongodb\data
Or you can create a configuration file and install mongo as a service.
.
Upvotes: 2