how to set mongod --dbpath

前端 未结 12 1697
囚心锁ツ
囚心锁ツ 2020-12-29 19:50

very new to mongodb and databases in general. whenever i run mongo i receive this error message: ​​​

MongoDB shell version: 2.         


        
12条回答
  •  有刺的猬
    2020-12-29 20:36

    You can set dbPath in the mongodb.conf file:

    storage:
        dbPath: "/path/to/your/database/data/db"
    

    It's a YAML-based configuration file format (since Mongodb 2.6 version), so pay attention no tabs only spaces, and space after ": "

    usually this file located in the *nix systems here: /etc/mongodb.conf

    So then just run

    $ mongod -f /etc/mongodb.conf
    

    And mongod process will start...

    (on the Windows something like)

    > C:\MongoDB\bin\mongod.exe -f C:\MongoDB\mongod.conf
    

提交回复
热议问题