why can't I start the mongodb

前端 未结 7 604
被撕碎了的回忆
被撕碎了的回忆 2020-12-04 10:10

this is the error:

(mysite)zjm1126@zjm1126-G41MT-S2:~$ /usr/local/mongodb/bin/mongod 
/usr/local/mongodb/bin/mongod --help for help and startup options
Wed A         


        
7条回答
  •  孤街浪徒
    2020-12-04 10:47

    On Mac OSX Yosemite after standard install with brew:

    sudo chown -R `id -u` /data/db
    

    if it not starts (check if there are no hanging and blocking connections):

    lsof -i:27017
    

    outputs something like:

    COMMAND   PID USER   FD   TYPE             DEVICE SIZE/OFF NODE NAME
    mongod  16948 andi    8u  IPv4 0x883a71bc9412939d      0t0  TCP *:27017 (LISTEN)
    

    take value of PID and run:

    kill -9 
    

    now you should be able to start mongo server: mongod and then e.g in separate console window connect to it with mongo

提交回复
热议问题