无法连接到 localhost:27017 处的 mongodb 错误:网络无法访问
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/44562325/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Cannot connect to the mongodb at localhost:27017 Error:Network is unreachable
提问by user8361258
I am trying to connect mongodb database(in ubuntu 16.04). I have already created a database. but i found : Cannot connect to the mongodb at localhost:27017 Error:Network is unreachable.
我正在尝试连接 mongodb 数据库(在 ubuntu 16.04 中)。我已经创建了一个数据库。但我发现:无法连接到 localhost:27017 处的 mongodb 错误:网络无法访问。
回答by Andrey.Kostyuchenko
Before, you must run
之前,你必须运行
mongod
in command line.
在命令行中。
回答by Aman Ullah
Before, you must run
之前,你必须运行
for windows
mongod
for linux or mac
sudo mongod
用于窗户
mongod
适用于 linux 或 mac
sudo mongod
on the command line.
在命令行上。
回答by user8361258
To start a MongoDB service that is in stop mode, please follow those steps
要启动处于停止模式的 MongoDB 服务,请按照以下步骤操作
- Press
window key + R
to openRun window
. - Then type
"services.msc"
to openservices window
. - Then select MongoDB server, right click on it, finally click on the
start
menu entry.
- 按
window key + R
打开Run window
。 - 然后输入
"services.msc"
打开services window
。 - 然后选择MongoDB服务器,右键点击它,最后点击
start
菜单项。
回答by Abhishek Aryan
- I was also facing this issue, Install mongodb and try after reconnecting localhost:27017.
- 我也面临这个问题,安装 mongodb 并在重新连接 localhost:27017 后尝试。