-2

I have successfully installed Mongo v4.2.0.

mongo --version
MongoDB shell version v4.2.0
git version: a4b751dcf51dd249c5865812b390cfd1c0129c30
OpenSSL version: OpenSSL 1.1.1c  28 May 2019
allocator: tcmalloc
modules: none
build environment:
    distmod: ubuntu1804
    distarch: x86_64
    target_arch: x86_64

But when i start mongo, it is showing error. Kindly help me out. I am using ubuntu 18.04. mongo

MongoDB shell version v4.2.0
connecting to: mongodb://127.0.0.1:27017/?compressors=disabled&gssapiServiceName=mongodb
2019-10-07T11:35:13.915+0530 E  QUERY    [js] Error: couldn't connect to server 127.0.0.1:27017, connection attempt failed: SocketException: Error connecting to 127.0.0.1:27017 :: caused by :: Connection refused :
connect@src/mongo/shell/mongo.js:341:17
@(connect):2:6
2019-10-07T11:35:13.916+0530 F  -        [main] exception: connect failed
2019-10-07T11:35:13.916+0530 E  -        [main] exiting with code 1
  • Most probably, you haven't started your mongod server, but trying to connect to it instead. Verify if mongodb is running and start it if not. – devm Oct 07 '19 at 06:18
  • [Read the manual.](https://docs.mongodb.com/manual/tutorial/install-mongodb-on-ubuntu/). Which is found by typing ["mongodb ubuntu install"](https://www.google.com/search?q=mongodb+ubuntu+install) into your search engine of choice. That's a link to the search results from one such search engine. Note that the marked duplicate ( with an answer which just paraphrases from the manual ) is also easily obtained from that same search string. – Neil Lunn Oct 07 '19 at 08:29

1 Answers1

0

First start your mongodb instance

mongod --port <your-choice-of-port> --dbpath=/path-of-your-db

and then connect to it.

devm
  • 227
  • 1
  • 12