Mongo无法启动 [英] Mongo is unable to start

查看:63
本文介绍了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 services and 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:

  1. 创建一个名为 data
  2. 的文件夹
  3. 在文件夹 data
  4. 中创建一个名为 db 的文件夹
  5. 现在右键单击数据文件夹,然后选择属性
  6. 点击安全性标签,然后在此处选择您的用户
  7. 点击完全控制选择框
  8. 单击确定,确定,确定...
  9. 重要!如果您在环境变量中没有设置路径" C:\ Program Files \ MongoDB \ Server \ 3.4 \ bin ",请进行设置
  10. 现在转到shell并输入: mongo --dbpath"C:\ Program Files \ MongoDB \ data \ db"
  1. Create a folder named data
  2. Create a folder named db inside the folder data
  3. Now right click on the data folder and choose properties
  4. Click security tab and select your user there
  5. Click the Full control select box
  6. Click ok, ok, ok ...
  7. important! if you don't have the path "C:\Program Files\MongoDB\Server\3.4\bin" set in environment variable, please set it.
  8. Now go to shell and type : mongod --dbpath "C:\Program Files\MongoDB\data\db"

就这样:)

这篇关于Mongo无法启动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆