本文介绍了Mongo无法启动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试通过cmd中的mongo
类型启动mongo uin Windows10.
I'm trying to start mongo uin windows10 by type: mongo
in cmd.
我收到此错误:
C:\Users\Itzik>mongo
MongoDB shell version v3.4.1
connecting to: mongodb://127.0.0.1:27017
2016-12-26T19:00:16.604+0200 W NETWORK [main] Failed to connect to 127.0.0.1:27017 after 5000ms milliseconds, giving up.
2016-12-26T19:00:16.605+0200 E QUERY [main] Error: couldn't connect to server 127.0.0.1:27017, connection attempt failed :
connect@src/mongo/shell/mongo.js:234:13
@(connect):1:6
exception: connect failed
C:\Users\Itzik>
我在防火墙中打开了端口27017,并重新启动mongo的服务而且仍然无法正常工作.
I have opened port 27017 in the firewall,and restart mongo's servicesand it still dont work.
那会是什么?
推荐答案
在C:\ Program Files \ MongoDB \中,您可能没有权限为用户创建文件/文件夹.而且 mongo 安装程序由于缺少用户的管理权限而无法创建它.
In C:\Program Files\MongoDB\ you might not have permission to create file/folder for your user. And mongo installer cannot create it because of lack of Administrative permission for your user.
因此在C:\ Program Files \ MongoDB中:
So in C:\Program Files\MongoDB:
- 创建一个名为 data 的文件夹
- 在文件夹 data 中创建一个名为 db 的文件夹
- 现在右键单击数据文件夹,然后选择属性
- 点击安全性标签,然后在此处选择您的用户
- 点击完全控制选择框
- 单击确定,确定,确定...
- 重要!如果您在环境变量中没有设置路径" C:\ Program Files \ MongoDB \ Server \ 3.4 \ bin ",请进行设置
- 现在转到shell并输入: mongo --dbpath"C:\ Program Files \ MongoDB \ data \ db"
- Create a folder named data
- Create a folder named db inside the folder data
- Now right click on the data folder and choose properties
- Click security tab and select your user there
- Click the Full control select box
- Click ok, ok, ok ...
- important! if you don't have the path "C:\Program Files\MongoDB\Server\3.4\bin" set in environment variable, please set it.
- Now go to shell and type : mongod --dbpath "C:\Program Files\MongoDB\data\db"
就这样:)
这篇关于Mongo无法启动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!