admin管理员组

文章数量:1241160

I have a Mac running 10.8.2 and just installed mongodb running the brew install mongodb mand. Everything seemed to be installed correctly. However when I run mongo to enter the shell I get the following error:

Alexander-Burgos-Collazos-MacBook:~ Alexander$ mongo
MongoDB shell version: 2.2.3
connecting to: test
Wed Feb  6 19:44:59 Error: couldn't connect to server 127.0.0.1:27017 src/mongo/shell/mongo.js:91
exception: connect failed

I followed some threads around here but never got a clear and concise answer as to how to fix it. I entered mongod in the mand terminal and it returned:

all output going to: /usr/local/var/log/mongodb/mongo.log

From there on everything I input does not return anything. I am confused as to how this really works.

I have a Mac running 10.8.2 and just installed mongodb running the brew install mongodb mand. Everything seemed to be installed correctly. However when I run mongo to enter the shell I get the following error:

Alexander-Burgos-Collazos-MacBook:~ Alexander$ mongo
MongoDB shell version: 2.2.3
connecting to: test
Wed Feb  6 19:44:59 Error: couldn't connect to server 127.0.0.1:27017 src/mongo/shell/mongo.js:91
exception: connect failed

I followed some threads around here but never got a clear and concise answer as to how to fix it. I entered mongod in the mand terminal and it returned:

all output going to: /usr/local/var/log/mongodb/mongo.log

From there on everything I input does not return anything. I am confused as to how this really works.

Share Improve this question edited Aug 19, 2013 at 18:25 techmsi 4431 gold badge5 silver badges21 bronze badges asked Feb 7, 2013 at 0:53 Alex BurgosAlex Burgos 1794 silver badges15 bronze badges 2
  • 1 docs.mongodb/manual/tutorial/install-mongodb-on-os-x In one terminal, start the mongo database with mongod. This process will not stop until you stop it as it's the database engine. In a new terminal window, mongo to start the shell. Go here then: docs.mongodb/manual/tutorial/getting-started – WiredPrairie Commented Feb 7, 2013 at 1:02
  • WiredPrairie thank you – Chiran Commented Feb 20, 2014 at 18:49
Add a ment  | 

3 Answers 3

Reset to default 13

May be mongod not started.

For start manually use mand:

/usr/local/opt/mongodb/mongod run --config /usr/local/etc/mongod.conf

But brew has a lanchctl plist. You can run this mand and mongodb launch at login:

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

More about brew version mongodb:

brew info mongodb

More about mongod you can read in manual.

Latest versions of Brew supports

brew services start mongodb

My mongo installation been corrupted and uninstalling mongo and reinstall worked for me, following procedure may be helpful

Remove mongodb from /usr/local/Cellar Remove mongod.conf files from /usr/local/etc Remove mongodb data from /usr/local/var

verify there should not be database exist at: /usr/local/etc use mand: cd /d verify no process should be running: ps aux | grep mongo

Reinstall mongo: http://docs.mongodb/manual/tutorial/install-mongodb-on-os-x/

本文标签: javascriptMongoDB won39t connect to 127001 on Mac OS XStack Overflow