mongo链接报错:couldn’t connect to server 127.0.0.1:27017 (127.0.0.1)

angela@angeladeMacBook-Air:/data/db$mongo
MongoDB shell version: 2.6.1
connecting to: test
2014-06-07T11:13:21.349+0800 warning: Failed to connect to 127.0.0.1:27017, reason: errno:61 Connection refused
2014-06-07T11:13:21.350+0800 Error: couldn’t connect to server 127.0.0.1:27017 (127.0.0.1), connection attempt failed at src/mongo/shell/mongo.js:146
exception: connect failed

 

mongo数据库数据存放的默认位置是/data/db

angela@angeladeMacBook-Air:/data/db$rm mongod.lock

angela@angeladeMacBook-Air:/data/db$mongod --dbpath="/data/db"

发表评论

电子邮件地址不会被公开。 必填项已用*标注