gpt4 book ai didi

Mongodb 连接失败(连接被拒绝)

转载 作者:可可西里 更新时间:2023-11-01 09:56:29 24 4
gpt4 key购买 nike

我是第一次在 OSX 上创建一个基本的网络应用程序。

我已经安装了 MongoDB,我可以从终端使用“mongo”命令,但我无法使用它进入 mongodb shell。

SOE-SOE01492:evnt humadshah$ mongo
MongoDB shell version v3.4.6
connecting to: mongodb://127.0.0.1:27017
2017-07-13T13:29:20.917+0500 W NETWORK [thread1] Failed to connect to 127.0.0.1:27017, in(checking socket for error after poll), reason: Connection refused
2017-07-13T13:29:20.917+0500 E QUERY [thread1] Error: couldn't connect to server 127.0.0.1:27017, connection attempt failed :
connect@src/mongo/shell/mongo.js:237:13
@(connect):1:6
exception: connect failed

我完全不知道是什么原因造成的。我以前从未在 Windows 上遇到过此错误。

最佳答案

我尝试了这段代码并为我工作。确保完全安装 mongodb。

$ brew services start mongodb

然后检查你的连接mongodb

$ mongo

结果:

Server has startup warnings: 
2017-10-01T10:54:13.444+0700 I CONTROL [initandlisten]
2017-10-01T10:54:13.445+0700 I CONTROL [initandlisten] ** WARNING: Access control is not enabled for the database.
2017-10-01T10:54:13.445+0700 I CONTROL [initandlisten] ** Read and write access to data and configuration is unrestricted.
2017-10-01T10:54:13.445+0700 I CONTROL [initandlisten]

关于Mongodb 连接失败(连接被拒绝),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45075397/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com