How do I start Mongo DB from Windows?

Solution 1:

Step 1

Download the mongodb

Step 2

  • Follow normal setup instructions

enter image description here

enter image description here

enter image description here

enter image description here

enter image description here

enter image description here

Step 3

  • Create the following folder

C:\data\db

Step 4

  • cd to C:\Program Files\MongoDB\Server\3.2\bin>
  • enter command mongod
  • by default, mongodb server will start at port 27017

enter image description here

Step 5

  • (optionally) download RoboMongo and follow normal setup instructions

enter image description here

enter image description here

enter image description here

enter image description here

enter image description here

enter image description here

Step 6

  • Start RoboMongo and create a new connection on localhost:27017

enter image description here

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:

  1. Download from http://www.mongodb.org/downloads
  2. Install .msi file in folder C:\mongodb
  3. Create data, data\db, log directories and mongo.config file under C:\mongodb.
  4. Add the following lines in "mongo.config" file

    port=27017
    dbpath=C:\mongodb\data\db\
    logpath=C:\mongodb\log\mongo.log
    
  5. Start server :

    mongod.exe --config="C:\mongodb\mongo.config"
    
  6. Connect to localhost MongoDB server via command line

    mongo --port 27017
    
  7. 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