MongoDB shell version: 2.4.14 connecting to: test Wed Jul 17 22:40:55.765 Error: couldn't connect to server 127.0.0.1:27017 at src/mongo/shell/mongo.js:145 exception: connect failed
sudo service mongodb stop sudo chown -R mongodb:mongodb /var/lib/mongodb sudo service mongodb start
修改目录权限后再次执行 mongo 命令,显示连接成功
MongoDB shell version: 2.4.14 connecting to: test Welcome to the MongoDB shell. For interactive help, type "help". For more comprehensive documentation, see http://docs.mongodb.org/ Questions? Try the support group http://groups.google.com/group/mongodb-user Server has startup warnings: Wed Jul 17 22:50:05.612 [initandlisten] Wed Jul 17 22:50:05.612 [initandlisten] ** NOTE: This is a 32 bit MongoDB binary. Wed Jul 17 22:50:05.612 [initandlisten] ** 32 bit builds are limited to less than 2GB of data (or less with --journal). Wed Jul 17 22:50:05.612 [initandlisten] ** See http://dochub.mongodb.org/core/32bit Wed Jul 17 22:50:05.612 [initandlisten] >