赞
踩
[root@localhost bin]# ./mongo
MongoDB shell version v3.4.5
connecting to: mongodb://127.0.0.1:27017
2017-11-20T11:10:49.895+0800 W NETWORK [thread1] Failed to connect to 127.0.0.1 :27017, in(checking socket for error after poll), reason: Connection refused
2017-11-20T11:10:49.896+0800 E QUERY [thread1] Error: couldn't connect to ser ver 127.0.0.1:27017, connection attempt failed :
connect@src/mongo/shell/mongo.js:237:13
@(connect):1:6
exception: connect failed
原因是未指定数据库位置
./mongod --dbpath /data/db你的数据库目录如果不是/data/db,可以通过 –dbpath 来指定
启动服务
连接
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。