I have Mongo installed on Ubuntu 16.04 machine, on VMWare. I start it using "mongo" command, last week there was no problem. But recently, it gives this error:
MongoDB shell version: 3.2.15 connecting to: test 2017-08-09T09:31:33.634+0300 W NETWORK [thread1] Failed to connect to 127.0.0.1:27017, in(checking socket for error after poll), reason: errno:111 Connection refused 2017-08-09T09:31:33.712+0300 E QUERY [thread1] Error: couldn't connect to server 127.0.0.1:27017, connection attempt failed : connect@src/mongo/shell/mongo.js:229:14 @(connect):1:6
exception: connect failed
I know how to solve it, it is here: https://stackoverflow.com/questions/12831939/couldnt-connect-to-server-127-0-0-127017/34835813#34835813
But everytime I reboot Ubuntu machine, the problem repeats. Why, and how can I prevent this happen everytime? Thanks.
Edit: Problem solved. You can see the solution below, in my comments to JJussi's answer.