0

I am getting the following error message when I try to connect MongoDB in mac

MongoDB shell version v3.4.9 connecting to: mongodb://127.0.0.1:27017 2017-11-27T12:27:26.105+0530 W NETWORK [thread1] Failed to connect to 127.0.0.1:27017, in(checking socket for error after poll), reason: Connection refused 2017-11-27T12:27:26.141+0530 E QUERY [thread1] Error: couldn't connect to server 127.0.0.1:27017, connection attempt failed : connect@src/mongo/shell/mongo.js:237:13 @(connect):1:6 exception: connect failed

2
  • 1
    I resolved the error. "Attempted to create a lock file on a read-only directory: /data/db, terminating" This was in read only form. I changed that giving > sudo chown -R $USER /data/db Commented Nov 27, 2017 at 7:23
  • You can post the answer . about how you have resolved your problem Commented Nov 27, 2017 at 7:24

1 Answer 1

0
sudo service mongod start
mongo
Sign up to request clarification or add additional context in comments.

1 Comment

I got the following error message sudo: service: command not found

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.