mongoDB服务启动失败(exception: connect failed)

  • Post author:
  • Post category:其他


[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 来指定

启动服务

启动服务

连接

连接



版权声明:本文为leisure_life原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。