Install Mongodb on windows 7 - 64 bit

2020-07-10 07:17发布

问题:

I am new to mongodb and not getting how to install it since i dint find videos or any helpful resources to achieve the same. Please help me for installing mongodb on windows 7 with the exact steps. I tried downloading recent version of mongodb from the site and its unsuccessful. Thanks in adcance.

Regards,

Vijay

回答1:

Steps:

  1. Download MongoDB this link link.
  2. Review MongoDB folder.

    In MongoDB, it contains only executable files 10 Plus(exe) in the bin folder. This is true, and That are the required files to MongoDB, it's really hard to believe for a developer like me Who eats from a relation database background.

    path:- Files under $MongoDB/bin folder
    
  3. Configuration File

    Create a MongoDB config file, it’s just a text file, for example C:\mongodb\mongo.config:

    #store data here
    dbpath=C:\mongodb\data
    
    \\all output go here
    logpath=C:\mongodb\log\mongo.log
    
    \\log read and write operations
    diaglog=3
    
  4. Run MongoDB server

    Use mongod.exe --config C:\mongodb\mongo.config to start MongoDB server.

    C:\mongodb\bin>mongod --config C:\mongodb\mongo.config
    

    All output going to: C:\mongodb\log\mongo.log

  5. Connect to MongoDB

    Uses mongo.exe to connect to the started MongoDB server.

    C:\mongodb\bin>mongo MongoDB shell version: 2.2.3 connecting to: test

    //mongodb shell

  6. MongoDB as Windows Service

    Add MongoDB as Windows Service, so that MongoDB will start automatically following each system restart. Install as Windows Service with --install.

    C:\mongodb\bin> mongod --config C:\mongodb\mongo.config --install
    

    A Windows service named “MongoDB” is created.

    To start MongoDB Service:

    net start MongoDB
    

    To stop MongoDB Service

    net stop MongoDB
    

    To remove MongoDB Service

    C:\mongodb\bin>mongod --remove
    

    Reference Link Install Mongodb



回答2:

  1. firstly you downloaded mongodb from here : https://www.mongodb.com/download-center?jmp=nav#community
  2. you unzip the folder in your directory example C:\..\MongoDB
  3. you open the command prompt ( demarrer>Invite commande)
  4. you go to your folder where the bin is and you write this on your command prompt : cd c:\..\mongodb\bin
  5. then you have to specifies the directory where you want to put the data, you can create a folder called : MongoData, and you whrite on your command prompt: Mongod --dbpath C:\..\MongoData


回答3:

For mongoDB 4.x, I got installation hung up several times in "wait for a few minutes..." I changed to v3.2.21-1 as recommended from searching the answer from web. It installed very quick and fast as I installed one year ago.



标签: mongodb