How to install mongoDB on windows?

前端 未结 15 650
清歌不尽
清歌不尽 2020-11-29 14:55

I am trying to test out mongoDB and see if it is anything for me. I downloaded the 32bit windows version, but have no idea on how to continue from now on.

I normally

15条回答
  •  一生所求
    2020-11-29 15:30

    1. Download .msi from https://www.mongodb.com/download-center#community

    2. Double click install - complete option

    3. Installation folder C:\Program Files\MongoDB\Server\3.6\bin

    4. Create database folder in C:// - c:/data/db and c:/data/log and c:/data/log/mongo.log and set write permission if not

    5. Open cmd prompt in Administrator mode , navigate to C:\Program Files\MongoDB\Server\3.6\bin

    6. Type the following

      C:\Program Files\MongoDB\Server\3.6\bin>mongod --dbpath="c:/data/db" --logpath="c:/data/log/mongo.log"

    7. Check folder c:/data/db - there should be many files and folder

    8. Create a config file named "mongo.config" ** inside C:\data\

    9. Type the following to set the config values from newly created config file

      C:\Program Files\MongoDB\Server\3.6\bin>mongod --config C:\data\mongo.config

    10. Open another new cmd prompt in Administrator mode , navigate to C:\Program Files\MongoDB\Server\3.6\bin execute the following lines on the console.

    11. Type the following to create service for MongoDB

      C:\Program Files\MongoDB\Server\3.6\bin>mongod --install --config C:\data\mongo.config --logpath="c:/data/log/mongo.log"

      If old MongoDB service exists then need to delete the old service first before mongod --install command, run the following in a new console to delete old mongodb service

      SC STOP MongoDB

      >> SC DELETE MongoDB
      
    12. Type the following to start MongoDB

      C:\Program Files\MongoDB\Server\3.6\bin>net start MongoDB

    13. Type the following to stop MongoDB

      C:\Program Files\MongoDB\Server\3.6\bin>net stop MongoDB

    Now connect the DB on ip - 127.0.0.1 or 192.168.5.64 on port 27017 .

    ** File name - "mongo.config" , paste the following on config file -

    bind_ip = 127.0.0.1,192.168.5.64

    port = 27017

    dbpath=C:\data\db

    logpath=C:\data\log\mongo.log

提交回复
热议问题