无法与Mongo连接

问题描述 投票:-2回答:1

当我尝试在终端中启动运行'mongo'命令的mongo shell时,我收到此错误:

connecting to: mongodb://127.0.0.1:27017
2017-12-23T17:52:51.318+0100 W NETWORK  [thread1] Failed to connect to 
127.0.0.1:27017, in(checking socket for error after poll), reason: 
Connection refused
2017-12-23T17:52:51.319+0100 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

我无法弄清楚问题是什么......

node.js mongodb
1个回答
0
投票

首先,您需要通过访问浏览器中的以下URL来检查mongo服务器是否在本地系统上运行。

http://127.0.0.1:27017

你可以在ubuntu的情况下运行以下命令。

  $ sudo service mongod start

然后,运行:

$ mongo
© www.soinside.com 2019 - 2024. All rights reserved.