How do I start Mongo DB from Windows?
Solution 1:
Step 1
Download the mongodb
Step 2
- Follow normal setup instructions
Step 3
- Create the following folder
C:\data\db
Step 4
-
cd
toC:\Program Files\MongoDB\Server\3.2\bin>
- enter command
mongod
- by default, mongodb server will start at port
27017
Step 5
- (optionally) download RoboMongo and follow normal setup instructions
Step 6
- Start RoboMongo and create a new connection on
localhost:27017
Your MongoDB is started and connected with RoboMongo (now Robo 3T) - a third party GUI tool
Solution 2:
This worked for me
mongod --port 27017 --dbpath C:\MongoDB\data\db
Solution 3:
- Download from http://www.mongodb.org/downloads
- Install .msi file in folder C:\mongodb
- Create data, data\db, log directories and mongo.config file under C:\mongodb.
-
Add the following lines in "mongo.config" file
port=27017 dbpath=C:\mongodb\data\db\ logpath=C:\mongodb\log\mongo.log
-
Start server :
mongod.exe --config="C:\mongodb\mongo.config"
-
Connect to localhost MongoDB server via command line
mongo --port 27017
-
Connect to remote MongoDB server via command line with authentication.
mongo --username abcd --password abc123 --host server_ip_or_dns --port 27017
That's it !!!
Solution 4:
Create MongoDB Service in Windows. First Open cmd with administrator
mongod --port 27017 --dbpath "a mongodb storage actual path e.g: d:\mongo_storage\data" --logpath="a log path e.g: d:\mongo_storage\log\log.txt" --install --serviceName "MongoDB"
After that
Start Service
net start MongoDB
Stop Service
net stop MongoDB