Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
666 views
in Technique[技术] by (71.8m points)

macos - Cannot connect to mongodb errno:61 Connection refused

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 which do not allow me to connect:

Failed to connect to 127.0.0.1:27017, reason: errno:61 Connection refused

Error: couldn't connect to server 127.0.0.1:27017 (127.0.0.1), connection attempt failed at src/mongo/shell/mongo.js:146

exception: connect failed
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

It can happen when the mongodb service is not running on the mac. To start it, I tried

brew services start mongodb

and it worked.

Edit: According to the discussion on this PR on homebrew: https://github.com/Homebrew/homebrew/issues/30628

brew services is deprecated, I looked around on SO and found these answers now answer the question: What is the correct way to start a mongod service on linux / OS X?


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...