How to resolve error :dbpath (/data/db/) does not exist permanently in MongoDB

前端 未结 5 369
旧巷少年郎
旧巷少年郎 2021-01-30 13:04

I have installed mongodb in my Ubuntu 10.04.

I know that when it comes to start the mongodb server with the command \"mongod\",then it expects /data/db

5条回答
  •  孤独总比滥情好
    2021-01-30 13:52

    Assuming you have followed the instructions to install a packaged version of MongoDB, you should be starting and stopping mongod using service.

    To start mongod:

     sudo service mongodb start
    

    To stop mongod:

     sudo service mongodb stop
    

    If you use the service command to start and stop, it should be using the configuration file: /etc/mongodb.conf.

    Starting mongod from the command line

    If you run mongod directly instead of using the service definition, you will also have to specify a configuration file as a command line parameter if you want one to be used:

    mongod --config /etc/mongodb.conf
    

提交回复
热议问题