I\'ve just installed MongoDB (standard Ubuntu build, not the latest stable) and for some reason I can\'t connect:
Mon Feb 6 03:11:22 Error: couldn\'t connect to
sudo rm /var/lib/mongodb/mongod.lock
I solved this problem by commenting out the following line in my /etc/mongod.conf
file.
# Listen to local interface only. Comment out to listen on all interfaces.
#bind_ip = 127.0.0.1
You will need to follow this config change with restarting the mongod process.
sudo service mongod restart
in /etc/mongod.conf
I changed,
bindIp: 127.0.0.1
to
bindIp: 0.0.0.0
which is all ports. Yeah, I know it's risky, but I am running on an internal network.
BTW commenting out #bindIp: 127.0.0.1
did NOT work for me, running under Ubuntu 18.