I can\'t connect to MongoDB. In Ubuntu it works, but I\'m working in CentOS now. This is the error message:
MongoDB shell version: 2.4.2
connecting
Try to remove /var/lib/mongodb/mongod.lock and restart mongdo service
sudo rm /var/lib/mongodb/mongod.lock
sudo service mongodb restart
You also get this error if you've changed the default port for mongoDB in /etc/mongo.conf
To connect via the shell in this case use:-
$mongo 127.0.0.1:your_new_port_number
OR
$mongo -u <user> -p <pass> --host <host> --port your_new_port_number
from MongoDB docs