New to MongoDB Can not run command mongo

前端 未结 15 1959
孤独总比滥情好
孤独总比滥情好 2021-01-29 20:00

I was trying to run MongoDB:

   E:\\mongo\\bin>mongod
    mongod --help for help and startup options
    Sun Nov 06 18:48:37
    Sun Nov 06 18:48:37 warning:          


        
15条回答
  •  北海茫月
    2021-01-29 20:25

    The very simplest approach given by mongo README help file

    RUNNING

    For command line options invoke:

    $ ./mongod --help
    

    To run a single server database:

    $ sudo mkdir -p /data/db
    $ ./mongod
    $
    $ # The mongo javascript shell connects to localhost and test database by default:
    $ ./mongo
    > help
    

    If you are working with windows, go to your directory where you have mongo.exe

    use the following commands, (I am sharing mine)

    C:\Program Files\MongoDB\Server\3.6\bin>mkdir \data
    
    C:\Program Files\MongoDB\Server\3.6\bin>mkdir \data\db
    
    C:\Program Files\MongoDB\Server\3.6\bin>mongod ## this will start your mongoDB server
    

    Now you need to run another CMD prompt and go to the directory where you have mongo and just run it

    C:\Program Files\MongoDB\Server\3.6\bin>mongo ## this will start your mongoDB client
    

    Hope it helped :)

    If it doesn't work, run CMD as an administrator

提交回复
热议问题