0

I'm trying to install mongo. I ran the following:

 $sudo chown -R [username] /usr/local ~ $sudo chmod -R u+w /usr/local ~ $brew link mongodb Linking /usr/local/Cellar/mongodb/3.0.2... 14 symlinks created 

I ran mongo and got the following:

~ $mongo MongoDB shell version: 3.0.2 connecting to: test 2015-04-14T09:21:29.095-0400 W NETWORK Failed to connect to 127.0.0.1:27017, reason: errno:61 Connection refused 2015-04-14T09:21:29.097-0400 E QUERY Error: couldn't connect to server 127.0.0.1:27017 (127.0.0.1), connection attempt failed at connect (src/mongo/shell/mongo.js:179:14) at (connect):1:6 at src/mongo/shell/mongo.js:179 exception: connect failed 

Not sure what to do.

1
  • I'm experiencing the same thing - same error and everything. I'm on Yosemite, 10.10.3. Commented May 22, 2015 at 15:32

2 Answers 2

1

If you don't specify a db address,

$ mongo <db-address> 

mongo gets lost in the woods. If you want a mongo shell without a db,

$ mongo -nodb 

does the trick.

If you're running locally, you probably either didn't specify a port (if the server isn't running on the default port 27107) or you just don't have a server running. The mongo command starts a shell, not the server. You need to

$ mongod --dbpath <path to data directory> 

to get the server running. Once it's up,

$ mongo 

should run locally with no problems.

Sign up to request clarification or add additional context in comments.

Comments

0

if you are using mac system you can try following command and then try

brew services restart mongodb-community 

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.