'mongo refusing connection on Ubuntu 16.04

Ubuntu 16.04

console output for running mongo on the terminal:

MongoDB shell version v3.6.3
connecting to: mongodb://127.0.0.1:27017
2018-03-27T18:23:41.006+0530 W NETWORK  [thread1] Failed to connect to 127.0.0.1:27017, in(checking socket for error after poll), reason: Connection refused
2018-03-27T18:23:41.006+0530 E QUERY    [thread1] Error: couldn't connect to server 127.0.0.1:27017, connection attempt failed :
connect@src/mongo/shell/mongo.js:251:13
@(connect):1:6
exception: connect failed


Solution 1:[1]

This answer by @CodeGench helped resolve my problems. Before doing it, I already tried uninstalling and reinstalling and all sorts of things which didn't work.

Solution 2:[2]

User This Command

sudo systemctl start mongod

Then

mongo

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 kaushal agrawal
Solution 2 Mehedi Setu