在 Windows 7 - 64 位上安装 Mongodb

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/37130239/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-08 20:44:41  来源:igfitidea点击:

Install Mongodb on windows 7 - 64 bit

mongodb

提问by Vijay

I am new to mongodb and not getting how to install it since i dint find videos or any helpful resources to achieve the same. Please help me for installing mongodb on windows 7 with the exact steps. I tried downloading recent version of mongodb from the site and its unsuccessful. Thanks in adcance.

我是 mongodb 的新手并且不知道如何安装它,因为我找不到视频或任何有用的资源来实现相同的目标。请帮助我按照确切的步骤在 Windows 7 上安装 mongodb。我尝试从该站点下载最新版本的 mongodb,但没有成功。提前致谢。

Regards,

问候,

Vijay

维杰

回答by Anuraj Mahajan

Steps:

脚步:

  1. Download MongoDB this link link.
  2. Review MongoDB folder.

    In MongoDB, it contains only executable files 10 Plus(exe) in the bin folder. This is true, and That are the required files to MongoDB, it's really hard to believe for a developer like me Who eats from a relation database background.

    path:- Files under $MongoDB/bin folder
    
  3. Configuration File

    Create a MongoDB config file, it's just a text file, for example C:\mongodb\mongo.config:

    #store data here
    dbpath=C:\mongodb\data
    
    \all output go here
    logpath=C:\mongodb\log\mongo.log
    
    \log read and write operations
    diaglog=3
    
  4. Run MongoDB server

    Use mongod.exe --config C:\mongodb\mongo.configto start MongoDB server.

    C:\mongodb\bin>mongod --config C:\mongodb\mongo.config
    

    All output going to: C:\mongodb\log\mongo.log

  5. Connect to MongoDB

    Uses mongo.exe to connect to the started MongoDB server.

    C:\mongodb\bin>mongo MongoDB shell version: 2.2.3 connecting to: test

    //mongodb shell

  6. MongoDB as Windows Service

    Add MongoDB as Windows Service, so that MongoDB will start automatically following each system restart. Install as Windows Service with --install.

    C:\mongodb\bin> mongod --config C:\mongodb\mongo.config --install
    

    A Windows service named “MongoDB” is created.

    To start MongoDB Service:

    net start MongoDB
    

    To stop MongoDB Service

    net stop MongoDB
    

    To remove MongoDB Service

    C:\mongodb\bin>mongod --remove
    

    Reference Link Install Mongodb

  1. 下载 MongoDB 此链接链接
  2. 查看 MongoDB 文件夹。

    在MongoDB中,bin文件夹中只包含可执行文件10 Plus(exe)。这是真的,而且那是MongoDB需要的文件,对于像我这样吃关系数据库背景的开发人员来说,真的很难相信。

    path:- Files under $MongoDB/bin folder
    
  3. 配置文件

    创建一个 MongoDB 配置文件,它只是一个文本文件,例如C:\mongodb\mongo.config

    #store data here
    dbpath=C:\mongodb\data
    
    \all output go here
    logpath=C:\mongodb\log\mongo.log
    
    \log read and write operations
    diaglog=3
    
  4. 执行MongoDB服务器

    使用mongod.exe --config C:\mongodb\mongo.config启动MongoDB的服务器。

    C:\mongodb\bin>mongod --config C:\mongodb\mongo.config
    

    所有输出到: C:\mongodb\log\mongo.log

  5. 连接到 MongoDB

    使用 mongo.exe 连接到启动的 MongoDB 服务器。

    C:\mongodb\bin>mongo MongoDB shell 版本:2.2.3 连接到:test

    //mongodb 外壳

  6. MongoDB 作为 Windows 服务

    将 MongoDB 添加为 Windows 服务,这样每次系统重启后 MongoDB 都会自动启动。使用--install.

    C:\mongodb\bin> mongod --config C:\mongodb\mongo.config --install
    

    创建了一个名为“MongoDB”的 Windows 服务。

    启动 MongoDB 服务:

    net start MongoDB
    

    停止MongoDB服务

    net stop MongoDB
    

    删除 MongoDB 服务

    C:\mongodb\bin>mongod --remove
    

    参考链接安装Mongodb

回答by d.el

  1. firstly you downloaded mongodb from here : https://www.mongodb.com/download-center?jmp=nav#community
  2. you unzip the folder in your directory example C:\..\MongoDB
  3. you open the command prompt ( demarrer>Invite commande)
  4. you go to your folder where the bin is and you write this on your command prompt : cd c:\..\mongodb\bin
  5. then you have to specifies the directory where you want to put the data, you can create a folder called : MongoData, and you whrite on your command prompt: Mongod --dbpath C:\..\MongoData
  1. 首先你从这里下载了 mongodb:https: //www.mongodb.com/download-center?jmp =nav#community
  2. 您解压缩目录示例中的文件夹 C:\..\MongoDB
  3. 你打开命令提示符(demarrer>Invite commande)
  4. 您转到 bin 所在的文件夹,然后在命令提示符下写入: cd c:\..\mongodb\bin
  5. 然后您必须指定要放置数据的目录,您可以创建一个名为:MongoData 的文件夹,然后在命令提示符下写入: Mongod --dbpath C:\..\MongoData

回答by Peter Chen

For mongoDB 4.x, I got installation hung up several times in "wait for a few minutes..." I changed to v3.2.21-1 as recommended from searching the answer from web. It installed very quick and fast as I installed one year ago.

对于 mongoDB 4.x,我在“等待几分钟......”中多次挂断安装,我按照从网上搜索答案的建议更改为 v3.2.21-1。它安装得非常快,就像我一年前安装的那样。