mongodb Error: couldn't connect to server 127.0.0.1:27017, connection attempt failed :

mongodb启动报错:
MongoDB shell version: 3.2.20
connecting to: test
2018-08-10T19:26:24.102+0800 W NETWORK [thread1] Failed to connect to 127.0.0.1:27017, in(checking socket for error after poll), reason: errno:111 Connection refused
2018-08-10T19:26:24.103+0800 E QUERY [thread1] Error: couldn’t connect to server 127.0.0.1:27017, connection attempt failed :
connect@src/mongo/shell/mongo.js:229:14
@(connect):1:6

exception: connect failed

网上找了很多办法都没有解决,自己找到了一个解决办法,如下:、
在这里插入图片描述
在这里插入图片描述

这里说 exception in initAndListen: 29 Data directory /data/db not found., terminating
在这里插入图片描述

我们自己创建文件夹,并更改权限,再次测试可以使用

在这里插入图片描述

猜你喜欢

转载自blog.csdn.net/lislislislislis/article/details/88919958
今日推荐