Cannot connect to mongodb errno:61 Connection refused

前端 未结 13 1302
心在旅途
心在旅途 2020-12-04 05:38

I recently installed mongodb-2.6.0 with Homebrew. After successfully installed, I tried to connect using the mongo command. I am receiving the following errors

13条回答
  •  佛祖请我去吃肉
    2020-12-04 06:19

    To solve your issue you need to follow the instructions which are then given to you by brew after you use "brew install mongodb".

    To have launchd start mongodb at login:

    ln -sfv /usr/local/opt/mongodb/*.plist ~/Library/LaunchAgents
    

    Then to load mongodb now:

    launchctl load ~/Library/LaunchAgents/homebrew.mxcl.mongodb.plist
    

    Or, if you don't want/need launchctl, you can just run:

    mongod --config /usr/local/etc/mongod.conf
    

    You may be able to just run that last command, but it didn't work for me and I needed to run the second command. To save me in the future. I just ran the first command too. Hope that helps!

    EDIT Hrishi's method of using brew services mongodb start worked good for me. I think they should include this in the mongo docs.

提交回复
热议问题