简体   繁体   English

如何在 Windows 上安装 mongoDB?

[英]How to install mongoDB on windows?

I am trying to test out mongoDB and see if it is anything for me.我正在尝试测试 mongoDB,看看它是否适合我。 I downloaded the 32bit windows version, but have no idea on how to continue from now on.我下载了 32 位 windows 版本,但不知道从现在开始如何继续。

I normally use the WAMP services for developing on my local computer.我通常使用 WAMP 服务在本地计算机上进行开发。 Can i run mongoDB on Wamp?我可以在 Wamp 上运行 mongoDB 吗?

However, what's the best (easiest!) way to make it work on windows?但是,使它在 Windows 上运行的最佳(最简单!)方法是什么?

Thanks!谢谢!

Mongo Installation Process in Windows Windows 中的 Mongo 安装过程

Are you ready for the installation … and use … Technically, it's not an installation it's just Downloading…您准备好安装了吗……并使用……从技术上讲,这不是安装,只是下载……

I. Download the zip file http://www.mongodb.org/downloads一、下载zip文件http://www.mongodb.org/downloads

II.二、 Extract it and copy the files into your desired location.提取它并将文件复制到您想要的位置。

III.三、 Start the DB engine.启动数据库引擎。

IV.四、 Test the installation and use it.测试安装并使用它。

That's it!就是这样! So simple, right?这么简单,对吧? Ok let's start好的,让我们开始


1. Download the zip file 1.下载压缩文件

  1. Go to http://www.mongodb.org/downloads转到http://www.mongodb.org/downloads

  2. You will see a screen like this:你会看到一个这样的屏幕:mongo下载页面 I am using a windows 7 32 bit machine - that's why I downloaded the package marked in red.我使用的是 Windows 7 32 位机器 - 这就是我下载标记为红色的包的原因。

  3. Click download (It only takes a few seconds).单击下载(只需几秒钟)。
    Wow... I got that downloaded.哇...我下载了。 It was a zipped file called mongodb-win32-i386-2.4.4.zip (The name of the folder will change according to the version you download, here I got version 2.4.4).它是一个名为mongodb-win32-i386-2.4.4.zip的压缩文件(文件夹的名称会根据您下载的版本而变化,我这里是 2.4.4 版本)。

OK all set. OK,一切就绪。


2. Extract 2. 提取

  1. Extract the zip解压缩
  2. Copy the files into a desired location in your machine.将文件复制到机器中的所需位置。
    • I am going to copy the extracted files to my D drive, since I don't have many files there.我准备将提取的文件复制到我的 D 盘,因为那里没有很多文件。
    • Alright then where are you planning to paste the mongo files?好吧,那么您打算将 mongo 文件粘贴到哪里? In C: or in your Desktop itself?在 C: 中还是在您的桌面中?
    • Ok, no matter where you paste... In the snap shot below, you can see that I have navigated to the bin folder inside the Mongo folder.好的,无论您粘贴到何处...在下面的快照中,您可以看到我已导航到 Mongo 文件夹内的 bin 文件夹。 I count fifteen files inside bin.我在 bin 内数了 15 个文件。 What about you?那你呢?

bin文件夹的路径

Finished!完成的! That's all就这样

What we have to do next?我们接下来要做什么?


3. Start the DB engine 3. 启动数据库引擎

Let's go and start using our mongo db...让我们开始使用我们的 mongo 数据库...

  1. Open up a command prompt, then navigate to bin in the mongo folder打开命令提示符,然后导航到 mongo 文件夹中的bin导航到 mongo 的 bin 文件夹

  2. Type mongo.exe (which is the command used to start mongo Db Power shell). mongo.exe (这是用于启动 mongo Db Power shell 的命令)。 Then see the below response..然后看下面的回复。。执行 mongo.exe That was an awesome exception J LOL … What is that?这是一个很棒的例外 J LOL ... 那是什么?

    Couldn't connect to server.无法连接到服务器。

    Why did the exception happen?为什么会发生异常? I have no idea... Did I create a server in between?我不知道......我在两者之间创建了一个服务器吗?

    No.不。

    Right, then how come it connected to a server in between?对了,那它怎么连接到中间的服务器呢? Silly Machine …Jz.傻机器……Jz。

    I got it!我知道了! Like all other DBs - we have to start the DB engine before we use it.像所有其他数据库一样 - 我们必须在使用它之前启动数据库引擎。

    So, how can we start it?那么,我们该如何开始呢?

  3. We have to start the mongo db by using the command mongod .我们必须使用命令mongod启动 mongo db。 Execute this from the bin folder of mongo.从 mongo 的bin文件夹执行此操作。

    Let's see what had happened.让我们看看发生了什么。

    错误信息

    Again a wonderfully formatted exception J we got right?又是一个奇妙的格式化异常 J 我们猜对了吗? Did you notice what I have highlighted on top?你注意到我在上面突出显示的内容了吗? Yeah it is the mongod command.是的,这是 mongod 命令。 The second one is the exception asking us to create a folder called data.第二个是要求我们创建一个名为 data 的文件夹的异常。 And, inside the data folder, a folder called db .并且,在 data 文件夹中,有一个名为db的文件夹。

    So we have to create these data\\db folders.所以我们必须创建这些data\\db文件夹。

    The next question is where to create these folders?下一个问题是在哪里创建这些文件夹?

  4. We have to create the data\\db folders in the C drive of our BOX in which we are installing mongo.我们必须在安装 mongo 的 BOX 的C驱动器中创建data\\db文件夹。 Let's go and create the folder structure in C drive.让我们去创建C盘的文件夹结构。

    A question arises here: "Is it mandatory to create the data\\db directories inside C?"这里出现了一个问题:“是否必须在 C 中创建 data\\db 目录?” Nooo, not really.不,不是真的。 Mongo looks in C by default for this folder, but you can create them wherever you want. Mongo 默认在C查找此文件夹,但您可以在任何地方创建它们。 However, if it's not in C , you have to tell mongo where it is.但是,如果它不在C ,则必须告诉 mongo 它在哪里。

    In other words, if you don't want the mongo databases to be on C:\\ , you have to set the db path for mongo.exe.换句话说,如果您不希望 mongo 数据库位于C:\\ ,则必须为 mongo.exe 设置数据库路径。

    Optional可选的

    • Ok, I will create those folders in some other location besides C for better understanding of this option.好的,我将在除C之外的其他位置创建这些文件夹,以便更好地理解此选项。 I will create then in the D drive root, with the help of cmd.然后我将在 cmd 的帮助下在D盘根目录中创建。

      Why?为什么? Because it's an opportunity for us to remember the old dos commands...因为这是我们记住旧的dos命令的机会......

      数据

    • The next step is to set the Db path to mongo.exe.下一步是将 Db 路径设置为 mongo.exe。

      Navigate back to bin , and enter the command, mongod.exe --dbpath d:\\data .导航回bin ,然后输入命令mongod.exe --dbpath d:\\data

      I got the response below:我得到以下回复:

      --dbpath

      I Hope everything went well... Because I didn't see any ERROR *** in the console J.我希望一切顺利...因为我在控制台 J 中没有看到任何 ERROR ***。

    Next, we can go and start the db using the command start mongo.exe接下来,我们可以使用命令start mongo.exe去启动数据库

    启动mongo.exe

    I didn't see any error or warning messages.我没有看到任何错误或警告消息。 But, we have to supply a command to make sure mongo is up and running, ie mongod will get a response:但是,我们必须提供一个命令来确保 mongo 启动并运行,即 mongod 将得到响应:

    mongodb 响应

Hope everything went well.希望一切顺利。


4. Test the Mongo DB installation 4.测试Mongo DB安装

Now we have to see our DB right?现在我们必须看到我们的数据库对吗? Yea very much, Otherwise how will we know it's running?非常好,否则我们怎么知道它正在运行?

For testing purpose MONGO has got a DB called test by default.出于测试目的,默认情况下 MONGO 有一个名为test的数据库。 Lets go query that.让我们去查询。

But how without any management studios?但是没有任何管理工作室怎么办? Unlike SQL, we have to depend on the command prompt.与 SQL 不同,我们必须依赖命令提示符。 Yes exactly the same command prompt… our good old command prompt… Heiiiii.. Don't get afraid yes it's our old command prompt only.是的,完全相同的命令提示符......我们的旧命令提示符...... Heiiii.. 不要害怕,是的,它只是我们的旧命令提示符。 Ok let's go and see how we are going to use it…好的,让我们去看看我们将如何使用它......

Ohhh Nooo… don't close the above Command prompt, leave it as it is… Ohhh Nooo...不要关闭上面的命令提示符,保持原样...

  1. Open a new cmd window.打开一个新的 cmd 窗口。

  2. Navigate to Bin as usual we do…像往常一样导航到 Bin,我们这样做......

    I am sure you people may be remembering the old C programming which we have done on our college day's right?我相信你们可能还记得我们在大学时代做过的旧 C 编程吧?

  3. In the command prompt, execute the command mongo or mongo.exe again and see what happens.在命令提示符下,再次执行命令mongomongo.exe ,看看会发生什么。

    You will get a screen as shown below:您将看到如下所示的屏幕:

    启动警告

  4. I mentioned before that Mongo has got a test db by default called test , try inserting a record into it.我之前提到过 Mongo 默认有一个名为test的测试数据库,尝试在其中插入一条记录。

    The next question here is "How will we insert?"下一个问题是“我们将如何插入?” Does mongo have SQL commands? mongo 有 SQL 命令吗? No, mongo has got only commands to help with.不,mongo 只有命令可以帮助。

    The basic command to insert is插入的基本命令是
    db.test.save( { KodothTestField: 'My name is Kodoth' } ) db.test.save( { KodothTestField: '我的名字是 Kodoth' } )

    Where test is the DB and .save is the insert command.其中test是数据库, .save是插入命令。 KodothTestField is the column or field name, and My name is Kodoth is the value. KodothTestField是列或字段名称, My name is Kodoth是值。

  5. Before talking more let's check whether it's stored or not by performing another command: db.test.find()在讨论更多之前,让我们通过执行另一个命令来检查它是否已存储: db.test.find()

    Mongo 命令用于搜索文档,类似于 SQL 中的 SELECT。

    Our Data got successfully inserted … Hurrayyyyyy..我们的数据已成功插入...... Hurrayyyyyy..

    I know that you are thinking about the number which is displayed with every record right called ObjectId.我知道您正在考虑与每个名为 ObjectId 的记录权限一起显示的数字。 It's like a unique id field in SQL that auto-increments and all.它就像 SQL 中的一个唯一 id 字段,它会自动递增等等。 Have a closer look you can see that the Object Id ends with 92, so it's different for each and every record.仔细观察,您会发现 Object Id 以 92 结尾,因此每条记录都不同。

    At last we are successful in installing and verifying the MONGO right.最后我们成功安装并验证了 MONGO 权限。 Let's have a party... So do you agree now MONGO is as Sweet as MANGO?让我们开个派对吧……所以你现在同意 MONGO 和 MANGO 一样甜蜜吗?

Also we have 3rd party tools to explore the MONGO.我们还有 3rd 方工具来探索 MONGO。 One is called MONGO VUE.一种叫做 MONGO VUE。 Using this tool we can perform operations against the mongo DB like we use Management studio for SQL Server.使用这个工具,我们可以像使用 SQL Server 的 Management Studio 一样对 mongo DB 执行操作。

Can you just imagine an SQL server or Oracle Db with entirely different rows in same table?您能想象一个 SQL 服务器或 Oracle Db 在同一个表中具有完全不同的行吗? Is it possible in our relational DB table?在我们的关系数据库表中可能吗? This is how mongo works.这就是 mongo 的工作方式。 I will show you how we can do that…我将向您展示我们如何做到这一点……


First I will show you how the data will look in a relational DB.首先,我将向您展示数据在关系数据库中的外观。

For example consider an Employee table and a Student table in relational way.例如,以关系方式考虑 Employee 表和 Student 表。 The schemas would be entirely different right?模式会完全不同,对吗? Yes exactly…对,就是这样…

结果视图

Let us now see how it will look in Mongo DB.现在让我们看看它在 Mongo DB 中的样子。 The above two tables are combined into single Collection in Mongo…以上两个表在 Mongo 中合并为一个 Collection…

MongoVUE

This is how Collections are stored in Mongo.这就是集合在 Mongo 中的存储方式。 I think now you can feel the difference really right?我想现在你真的能感觉到差异了吧? Every thing came under a single umbrella.每件事都在一把伞下。 This is not the right way but I just wanted to show you all how this happens that's why I combined 2 entirely different tables in to one single Collection.这不是正确的方法,但我只是想向大家展示这是如何发生的,这就是为什么我将 2 个完全不同的表合并到一个集合中。

If you want to try out you can use below test scripts如果你想尝试,你可以使用下面的测试脚本

*********************** 
TEST INSERT SCRIPT

*********EMPLOYEE****** 
db.test.save( { EmployeId: "1", EmployeFirstName: "Kodoth", EmployeLastName:"KodothLast", EmployeAge:"14" } )  
db.test.save( { EmployeId: "2", EmployeFirstName: "Kodoth 2", EmployeLastName:"Kodoth Last2", EmployeAge:"14" } )  
db.test.save( { EmployeId: "3", EmployeFirstName: "Kodoth 3", EmployeLastName:"Kodoth Last3", EmployeAge:"14" } ) 

******STUDENT****** 
db.test.save( { StudentId: "1", StudentName: "StudentName", StudentMark:"25" } )  
db.test.save( { StudentId: "2", StudentName: "StudentName 2", StudentMark:"26" } )  
db.test.save( {StudentId: "3", StudentName: "StudentName 3", StudentMark:"27"} )
************************

Thanks谢谢

It's not like WAMP.它不像 WAMP。 You need to start mongoDB database with a command after directory has been created C:/database_mongo创建目录后,您需要使用命令启动 mongoDB 数据库 C:/database_mongo

mongod --dbpath=C:/database_mongo/

you can then connect to mongodb using commands.然后您可以使用命令连接到 mongodb。

Pretty good documentation is provided on the MongoDB website MongoDB 网站上提供了相当不错的文档

Install MongoDB安装 MongoDB

  1. Determine which MongoDB build you need.确定您需要哪个 MongoDB 构建。

    There are three builds of MongoDB for Windows:适用于 Windows 的 MongoDB 共有三个版本:

    MongoDB for Windows Server 2008 R2 edition (ie 2008R2) runs only on Windows Server 2008 R2, Windows 7 64-bit, and newer versions of Windows. MongoDB for Windows Server 2008 R2 版本(即 2008R2)仅在 Windows Server 2008 R2、Windows 7 64 位和更新版本的 Windows 上运行。 This build takes advantage of recent enhancements to the Windows Platform and cannot operate on older versions of Windows.此版本利用了 Windows 平台的最新增强功能,无法在旧版本的 Windows 上运行。

    MongoDB for Windows 64-bit runs on any 64-bit version of Windows newer than Windows XP, including Windows Server 2008 R2 and Windows 7 64-bit.适用于 Windows 64 位的 MongoDB 可在比 Windows XP 更新的任何 64 位 Windows 版本上运行,包括 Windows Server 2008 R2 和 Windows 7 64 位。

    MongoDB for Windows 32-bit runs on any 32-bit version of Windows newer than Windows XP.适用于 Windows 32 位的 MongoDB 可在比 Windows XP 更新的任何 32 位 Windows 版本上运行。 32-bit versions of MongoDB are only intended for older systems and for use in testing and development systems. 32 位版本的 MongoDB 仅适用于较旧的系统以及用于测试和开发系统。 32-bit versions of MongoDB only support databases smaller than 2GB. 32 位版本的 MongoDB 仅支持小于 2GB 的数据库。

    To find which version of Windows you are running, enter the following command in the Command Prompt:要查找您正在运行的 Windows 版本,请在命令提示符中输入以下命令:

     wmic os get osarchitecture
  2. Download MongoDB for Windows.下载适用于 Windows 的 MongoDB。

    Download the latest production release of MongoDB from the MongoDB downloads page.从 MongoDB 下载页面下载 MongoDB 的最新生产版本。 Ensure you download the correct version of MongoDB for your Windows system.确保为您的 Windows 系统下载正确版本的 MongoDB。 The 64-bit versions of MongoDB does not work with 32-bit Windows. 64 位版本的 MongoDB 不适用于 32 位 Windows。

  3. Install the downloaded file.安装下载的文件。

    In Windows Explorer, locate the downloaded MongoDB msi file, which typically is located in the default Downloads folder.在 Windows 资源管理器中,找到下载的 MongoDB msi 文件,该文件通常位于默认的下载文件夹中。 Double-click the msi file.双击 msi 文件。 A set of screens will appear to guide you through the installation process.将出现一组屏幕,指导您完成安装过程。

  4. Move the MongoDB folder to another location (optional).将 MongoDB 文件夹移动到另一个位置(可选)。

    To move the MongoDB folder, you must issue the move command as an Administrator.要移动 MongoDB 文件夹,您必须以管理员身份发出移动命令。 For example, to move the folder to C:\\mongodb:例如,要将文件夹移动到 C:\\mongodb:

    Select Start Menu > All Programs > Accessories .选择开始菜单>所有程序>附件

    Right-click Command Prompt and select Run as Administrator from the popup menu.右键单击命令提示符并从弹出菜单中选择以管理员身份运行。

    Issue the following commands:发出以下命令:

     cd \\ move C:\\mongodb-win32-* C:\\mongodb

    MongoDB is self-contained and does not have any other system dependencies. MongoDB 是自包含的,没有任何其他系统依赖项。 You can run MongoDB from any folder you choose.您可以从您选择的任何文件夹运行 MongoDB。 You may install MongoDB in any folder (eg D:\\test\\mongodb )您可以将 MongoDB 安装在任何文件夹中(例如D:\\test\\mongodb

Run MongoDB运行 MongoDB

Warning:警告:

Do not make mongod.exe visible on public networks without running in “Secure Mode” with the auth setting.如果没有使用 auth 设置在“安全模式”下运行,请不要让mongod.exe在公共网络上可见。 MongoDB is designed to be run in trusted environments, and the database does not enable “Secure Mode” by default. MongoDB 旨在运行在受信任的环境中,数据库默认不启用“安全模式”。

  1. Set up the MongoDB environment.设置 MongoDB 环境。

    MongoDB requires a data directory to store all data. MongoDB 需要一个数据目录来存储所有数据。 MongoDB's default data directory path is \\data\\db. MongoDB 的默认数据目录路径是\\data\\db。 Create this folder using the following commands from a Command Prompt:从命令提示符使用以下命令创建此文件夹:

     md \\data\\db

    You can specify an alternate path for data files using the --dbpath option to mongod.exe , for example:您可以指定使用数据文件的备用路径--dbpath选项mongod.exe ,例如:

     C:\\mongodb\\bin\\mongod.exe --dbpath d:\\test\\mongodb\\data

    If your path includes spaces, enclose the entire path in double quotes, for example:如果您的路径包含空格,请将整个路径用双引号括起来,例如:

     C:\\mongodb\\bin\\mongod.exe --dbpath "d:\\test\\mongo db data"
  2. Start MongoDB.启动 MongoDB。

    To start MongoDB, run mongod.exe .要启动 MongoDB,请运行mongod.exe For example, from the Command Prompt:例如,从命令提示符:

     C:\\Program Files\\MongoDB\\bin\\mongod.exe

    This starts the main MongoDB database process.这将启动主 MongoDB 数据库进程。 The waiting for connections message in the console output indicates that the mongod.exe process is running successfully.控制台输出中的等待连接消息表明 mongod.exe 进程运行成功。

    Depending on the security level of your system, Windows may pop up a Security Alert dialog box about blocking “some features” of C:\\Program Files\\MongoDB\\bin\\mongod.exe from communicating on networks.根据您系统的安全级别,Windows 可能会弹出一个安全警报对话框,内容是阻止 C:\\Program Files\\MongoDB\\bin\\mongod.exe 的“某些功能”在网络上进行通信。 All users should select Private Networks, such as my home or work network and click Allow access.所有用户都应选择专用网络,例如我的家庭或工作网络,然后单击允许访问。 For additional information on security and MongoDB, please see the Security Documentation.有关安全性和 MongoDB 的其他信息,请参阅安全文档。

  3. Connect to MongoDB.连接到 MongoDB。

    To connect to MongoDB through the mongo.exe shell, open another Command Prompt.要通过 mongo.exe shell 连接到 MongoDB,请打开另一个命令提示符。 When connecting, specify the data directory if necessary.连接时,根据需要指定数据目录。 This step provides several example connection commands.此步骤提供了几个示例连接命令。

    If your MongoDB installation uses the default data directory, connect without specifying the data directory:如果您的 MongoDB 安装使用默认数据目录,请在不指定数据目录的情况下进行连接:

     C:\\mongodb\\bin\\mongo.exe

    If you installation uses a different data directory, specify the directory when connecting, as in this example:如果您安装使用不同的数据目录,请在连接时指定目录,如下例所示:

     C:\\mongodb\\bin\\mongod.exe --dbpath d:\\test\\mongodb\\data

    If your path includes spaces, enclose the entire path in double quotes.如果您的路径包含空格,请将整个路径用双引号括起来。 For example:例如:

     C:\\mongodb\\bin\\mongod.exe --dbpath "d:\\test\\mongo db data"

    If you want to develop applications using .NET, see the documentation of C# and MongoDB for more information.如果您想使用 .NET 开发应用程序,请参阅 C# 和 MongoDB 的文档以获取更多信息。

  4. Begin using MongoDB.开始使用 MongoDB。

    To begin using MongoDB, see Getting Started with MongoDB.要开始使用 MongoDB,请参阅 MongoDB 入门。 Also consider the Production Notes document before deploying MongoDB in a production environment.在生产环境中部署 MongoDB 之前,还要考虑生产注释文档。

    Later, to stop MongoDB, press Control+C in the terminal where the mongod instance is running.稍后,要停止 MongoDB,请在运行 mongod 实例的终端中按 Control+C。

Configure a Windows Service for MongoDB为 MongoDB 配置 Windows 服务

Note:笔记:

There is a known issue for MongoDB 2.6.0, SERVER-13515, which prevents the use of the instructions in this section. MongoDB 2.6.0 存在一个已知问题 SERVER-13515,它阻止使用本节中的说明。 For MongoDB 2.6.0, use Manually Create a Windows Service for MongoDB to create a Windows Service for MongoDB instead.对于 MongoDB 2.6.0,请改用手动为 MongoDB 创建 Windows 服务来为 MongoDB 创建 Windows 服务。

  1. Configure directories and files.配置目录和文件。

    Create a configuration file and a directory path for MongoDB log output (logpath):为 MongoDB 日志输出创建配置文件和目录路径(logpath):

    Create a specific directory for MongoDB log files:为 MongoDB 日志文件创建特定目录:

     md "C:\\Program Files\\MongoDB\\log"

    In the Command Prompt, create a configuration file for the logpath option for MongoDB:在命令提示符中,为 MongoDB 的 logpath 选项创建一个配置文件:

     echo logpath=C:\\Program Files\\MongoDB\\log\\mongo.log > "C:\\Program Files\\MongoDB\\mongod.cfg"
  2. Run the MongoDB service.运行 MongoDB 服务。

    Run all of the following commands in Command Prompt with “Administrative Privileges:”使用“管理权限”在命令提示符中运行以下所有命令:

    Install the MongoDB service.安装 MongoDB 服务。 For --install to succeed, you must specify the logpath run-time option.要使--install成功,您必须指定 logpath 运行时选项。

     "C:\\Program Files\\MongoDB\\bin\\mongod.exe" --config "C:\\Program Files\\MongoDB\\mongod.cfg" --install

    Modify the path to the mongod.cfg file as needed.根据需要修改 mongod.cfg 文件的路径。

    To use an alternate dbpath, specify the path in the configuration file (eg C:\\Program Files\\MongoDB\\mongod.cfg) or on the command line with the --dbpath option.要使用备用 dbpath,请在配置文件(例如 C:\\Program Files\\MongoDB\\mongod.cfg)中或在命令行中使用 --dbpath 选项指定路径。

    If the dbpath directory does not exist, mongod.exe will not start.如果 dbpath 目录不存在,mongod.exe 将不会启动。 The default value for dbpath is \\data\\db . dbpath 的默认值为\\data\\db

    If needed, you can install services for multiple instances of mongod.exe or mongos.exe.如果需要,您可以为 mongod.exe 或 mongos.exe 的多个实例安装服务。 Install each service with a unique --serviceName and --serviceDisplayName .使用唯一的--serviceName--serviceDisplayName安装每个服务。 Use multiple instances only when sufficient system resources exist and your system design requires it.仅当存在足够的系统资源且您的系统设计需要时才使用多个实例。

  3. Stop or remove the MongoDB service as needed.根据需要停止或删除 MongoDB 服务。

    To stop the MongoDB service use the following command:要停止 MongoDB 服务,请使用以下命令:

     net stop MongoDB

    To remove the MongoDB service use the following command:要删除 MongoDB 服务,请使用以下命令:

     "C:\\Program Files\\MongoDB\\bin\\mongod.exe" --remove

Manually Create a Windows Service for MongoDB手动为 MongoDB 创建 Windows 服务

The following procedure assumes you have installed MongoDB using the MSI installer, with the default path C:\\Program Files\\MongoDB 2.6 Standard.以下过程假设您已使用 MSI 安装程序安装了 MongoDB,默认路径为 C:\\Program Files\\MongoDB 2.6 Standard。

If you have installed in an alternative directory, you will need to adjust the paths as appropriate.如果已安装在备用目录中,则需要适当调整路径。

  1. Open an Administrator command prompt.打开管理员命令提示符。

    Windows 7 / Vista / Server 2008 (and R2) Windows 7 / Vista / Server 2008(和 R2)

    Press Win + R , then type cmd , then press Ctrl + Shift + Enter .Win + R ,然后键入cmd ,然后按Ctrl + Shift + Enter

    Windows 8视窗 8

    Press Win + X , then press A .Win + X ,然后按A

    Execute the remaining steps from the Administrator command prompt.从管理员命令提示符执行其余步骤。

  2. Create directories.创建目录。

    Create directories for your database and log files:为您的数据库和日志文件创建目录:

     mkdir c:\\data\\db mkdir c:\\data\\log
  3. Create a configuration file.创建配置文件。

    Create a configuration file.创建配置文件。 This file can include any of the configuration options for mongod, but must include a valid setting for logpath:此文件可以包含 mongod 的任何配置选项,但必须包含 logpath 的有效设置:

    The following creates a configuration file, specifying both the logpath and the dbpath settings in the configuration file:下面创建一个配置文件,在配置文件中指定 logpath 和 dbpath 设置:

     echo logpath=c:\\data\\log\\mongod.log> "C:\\Program Files\\MongoDB 2.6 Standard\\mongod.cfg" echo dbpath=c:\\data\\db>> "C:\\Program Files\\MongoDB 2.6 Standard\\mongod.cfg"
  4. Create the MongoDB service.创建 MongoDB 服务。

    Create the MongoDB service.创建 MongoDB 服务。

     sc.exe create MongoDB binPath= "\\"C:\\Program Files\\MongoDB 2.6 Standard\\bin\\mongod.exe\\" --service --config=\\"C:\\Program Files\\MongoDB 2.6 Standard\\mongod.cfg\\"" DisplayName= "MongoDB 2.6 Standard" start= "auto"

    sc.exe requires a space between “ = ” and the configuration values (eg “ binPath= ”), and a “” to escape double quotes. sc.exe需要在“ = ”和配置值(例如“ binPath= ”)之间有一个空格,并需要一个“”来转义双引号。

    If successfully created, the following log message will display:如果创建成功,将显示以下日志消息:

     [SC] CreateService SUCCESS
  5. Start the MongoDB service.启动 MongoDB 服务。

     net start MongoDB
  6. Stop or remove the MongoDB service as needed.根据需要停止或删除 MongoDB 服务。

    To stop the MongoDB service, use the following command:要停止 MongoDB 服务,请使用以下命令:

     net stop MongoDB

    To remove the MongoDB service, first stop the service and then run the following command:要删除 MongoDB 服务,请先停止该服务,然后运行以下命令:

     sc.exe delete MongoDB

I realize you've already accepted an answer for this, but I wrote this short howto article to install mongodb into the c:\\wamp directory and run it as a service.我意识到你已经接受了这个答案,但我写了这篇简短的 howto 文章来将 mongodb 安装到c:\\wamp目录中并将其作为服务运行。 Here is the gist of it.这是它的要点。

Create these directories创建这些目录

mkdir c:\wamp\bin\mongodb\mongodb-win32...2.x.x\data
mkdir c:\wamp\bin\mongodb\mongodb-win32...2.x.x\data\db
mkdir c:\wamp\bin\mongodb\mongodb-win32...2.x.x\logs
mkdir c:\wamp\bin\mongodb\mongodb-win32...2.x.x\conf

Download and extract win32 binaries into c:\\wamp directory along side mysql, apache.将 win32 二进制文件下载并解压到 mysql、apache 旁边的 c:\\wamp 目录中。

mongodb download page mongodb下载页面

Create a mongo.conf file创建一个 mongo.conf 文件

c:\wamp\bin\mongodb\mongodb-win32…2.x.x\conf\mongodb.conf

# mongodb.conf

# data lives here
dbpath=C:\wamp\bin\mongodb\mongodb-win32...2.x.x\data\db

# where to log
logpath=C:\wamp\bin\mongodb\mongodb-win32...2.x.x\logs\mongodb.log
logappend=true

# only run on localhost for development
bind_ip = 127.0.0.1                                                             

port = 27017
rest = true

Install as a service作为服务安装

mongod.exe --install --config c:\wamp\bin\mongodb\mongodb-win32...2.x.x\conf\mongodb.conf --logpath c:\wamp\bin\mongodb\mongodb-win32...2.x.x\logs\mongodb.log

Set service to automatic and start it using services.msc将服务设置为自动并使用 services.msc 启动它

Add path to mongo.exe to your path将 mongo.exe 的路径添加到您的路径中

Need more details?需要更多细节? Read the full article here...在此处阅读全文...

Installing MongoDB on Windows the WAMP way 在 Windows 上以 WAMP 方式安装 MongoDB

Step by Step Solution for windows 32 bit Windows 32 位的分步解决方案

  1. Download msi file for windows 32 bit.下载适用于 Windows 32 位的 msi 文件。
  2. Double click Install it, choose custom and browse the location where ever you have to install(personally i have create the mongodb folder in E drive and install it there).双击安装,选择自定义并浏览您必须安装的位置(我个人已经在 E 驱动器中创建了 mongodb 文件夹并将其安装在那里)。
  3. Ok,now you have to create the data\\db two folder where ever create it, i've created it in installed location root eg on E:\\好的,现在您必须在创建它的地方创建 data\\db 两个文件夹,我已经在安装位置根目录中创建了它,例如在 E:\\
  4. Now link the mongod to these folder for storing data use this command or modify according to your requirement go to using cmd E:\\mongodb\\bin and after that write in console mongod --dbpath E:\\data it will link.现在将 mongod 链接到这些用于存储数据的文件夹,使用此命令或根据您的要求进行修改,转到使用 cmd E:\\mongodb\\bin ,然后在控制台中写入mongod --dbpath E:\\data它将链接。
  5. Now navigate to E:\\mongodb\\bin and write mongod using cmd.现在导航到 E:\\mongodb\\bin 并使用 cmd 编写 mongod。
  6. Open another cmd by right click and run as admin point to your monogodb installed directory and then to bin just like E:\\mongodb\\bin and write this mongo.exe通过右键单击打开另一个 cmd 并以管理员身份运行到您的 monogodb 安装目录,然后像 E:\\mongodb\\bin 一样进入 bin 并编写这个 mongo.exe
  7. Next - write db.test.save({Field:'Hello mongodb'}) this command will insert the a field having name Field and its value Hello mongodb .接下来 - 编写db.test.save({Field:'Hello mongodb'})这个命令将插入一个具有名称Field和它的值Hello mongodb 的字段
  8. Next, check the record db.test.find() and press enter you will find the record that you have recently entered.接下来,检查记录db.test.find()并按回车键,您将找到您最近输入的记录。

1. Download MongoDB 1. 下载MongoDB

2. Install MongoDB 2.安装MongoDB

3. Create the required folders: 3. 创建所需的文件夹:

"C:\MongoDB_2_6_Standard\bin\data\db"
"C:\MongoDB_2_6_Standard\logs"
"C:\MongoDB_2_6_Standard\etc"

NOTE: If the directories do not exist, mongod.exe will not start.注意:如果目录不存在,mongod.exe 将不会启动。

4. Create a simple configuration file: 4. 创建一个简单的配置文件:

systemLog:
    destination: file
    path: C:\MongoDB_2_6_Standard\logs\mongo.log
    logAppend: true
net:
    bindIp: 127.0.0.1
    port: 27017

More info about how to create a configuration file:http://docs.mongodb.org/manual/reference/configuration-options/有关如何创建配置文件的更多信息:http ://docs.mongodb.org/manual/reference/configuration-options/

5. Install MongoDB as a Windows Service (this way it will start automatically when you reboot your computer) 5. 将 MongoDB 安装为 Windows 服务(这样它会在您重新启动计算机时自动启动)

Run cmd with administrator privilegies, and enter the following commands:以管理员权限运行cmd,输入以下命令:

"C:\MongoDB_2_6_Standard\bin\mongod.exe" --config "C:\MongoDB_2_6_Standard\etc\mongodb.conf" --dbpath c:\MongoDB_2_6_Standard\bin\data\db --directoryperdb --install

6. Start the MongoDB Windows Service 6. 启动 MongoDB Windows 服务

net start MongoDB

7. Connect to MongoDB via shell/cmd for testing 7.通过shell/cmd连接MongoDB进行测试

C:\MongoDB_2_6_Standard\bin\mongo.exe

NOTE: http://docs.mongodb.org/manual/tutorial/getting-started-with-the-mongo-shell/注意: http : //docs.mongodb.org/manual/tutorial/getting-started-with-the-mongo-shell/

8. That's it! 8. 就是这样! You are done.你完成了。 :) :)

9. Uninstall/remove the MongoDB Windows Service (if you messed up something) 9.卸载/删除MongoDB Windows服务(如果你搞砸了什么)

"C:\MongoDB_2_6_Standard\bin\mongod.exe" --remove

Its very simple to install Mongo DB on windows 7 ( i used 32 bit win7 OS)在 Windows 7 上安装 Mongo DB 非常简单(我使用的是 32 位 win7 操作系统)

  1. Install the correct version of Mongodb ( according to ur bit 32/64 .. imp :- 64 bit is not compatible with 32 bit and vice versa)安装正确版本的 Mongodb(根据您的位 32/64 .. imp :- 64 位与 32 位不兼容,反之亦然)

2.u can install Mongodb from thius website ( acc to ur OS) http://www.mongodb.org/downloads?_ga=1.79549524.1754732149.1410784175 2.您可以从thius网站(根据您的操作系统)安装Mongodb http://www.mongodb.org/downloads?_ga=1.79549524.1754732149.1410784175

  1. DOWNLOAD THE .MSI OR zip file .. and install with proper privellages下载 .MSI 或 zip 文件 .. 并使用适当的权限安装

4.copy the mongodb folder from c:programfiles to d: [optional] 4.将mongodb文件夹从c:programfiles复制到d:[可选]

5.After installation open command prompt ( as administrator .. right click on cmd and u will find the option) 5.安装后打开命令提示符(以管理员身份..右键单击cmd,您将找到该选项)

  1. navigate to D:\\MongoDB 2.6 Standard\\bin导航到 D:\\MongoDB 2.6 Standard\\bin

  2. run mongo.exe ... you might get this error运行 mongo.exe ... 你可能会收到这个错误你可能会收到这个错误

  3. If you get then no isse you just need to do following steps如果你得到那么没有问题,你只需要执行以下步骤

i) try the coomand in following image yo will get to know the error i) 尝试下图中的 coomand 你会知道错误在此处输入图片说明

ii)This means that u neeed to create a directory \\data\\db ii)这意味着你需要创建一个目录\\data\\db

iii) now you have two options either create above directory in c drive or create any "xyz" name directory somewhere else ( doesnot make and diffrence) .. lets create a directory of mongodata in d: iii) 现在您有两个选项,要么在 c 驱动器中创建上面的目录,要么在其他地方创建任何“xyz”名称目录(不制作和差异)..让我们在 d 中创建一个 mongodata 目录:

在此处输入图片说明

  1. Now lets rerun the command but now like this :- mongod --dbpath d:\\mongodata [shown in fig] this time you will not get and error现在让我们重新运行命令,但现在像这样:- mongod --dbpath d:\\mongodata [如图所示] 这次你不会得到和错误

在此处输入图片说明

  1. Hope everything is fine till this point .. open new command propmt [sufficent privellages (admin)]希望到目前为止一切都很好..打开新命令 propmt [sufficent privellages (admin)]

colured in orange will be the command u need to run .. it will open the new command propmt which we known as mongo shell (or mongodb shell)橙色将是您需要运行的命令..它将打开我们称为 mongo shell(或 mongodb shell)的新命令 propmt

在此处输入图片说明

11.dont close the shell[any of command promt as well] as in this we will create /delete/insert our databse operations 11.不要关闭外壳[任何命令提示符],因为在此我们将创建/删除/插入我们的数据库操作

  1. Lets perform basic operation让我们执行基本操作

a) show databases b) show current databse c) creation of collection / inserting data into it (name will be test) d) show data of collection a) 显示数据库 b) 显示当前数据库 c) 创建集合/将数据插入其中(名称将是测试) d) 显示集合数据

12.please find scrren shot of results of our operation .. please not :- dont close any command propmt 12.请找到我们操作结果的屏幕截图..请不要:-不要关闭任何命令提示

在此处输入图片说明

  1. a diffrent structure type of number is object id :- which is created automatically数字的不同结构类型是对象 id :- 它是自动创建的

  2. Hope you get some important info for installing mongodb DB.希望你能得到一些安装 mongodb DB 的重要信息。

Installing MongoDB on Windows is bit tricky compared to other Executable files.. Got a good reference after long search i got Installing MongoDB in Windows与其他可执行文件相比,在 Windows 上安装 MongoDB 有点棘手。经过长时间的搜索,我得到了很好的参考,我得到了在 Windows 中安装 MongoDB

After Installing open command prompt and type " mongod ", then keep the window minimized and open another command prompt window and type " mongo " and you will find the success message of connecting to the test database安装后打开命令提示符输入“ mongod ”,然后保持窗口最小化并打开另一个命令提示符窗口并输入“ mongo ”,您将看到连接到测试数据库的成功信息

Update Nov -2017 -2017 年 11 月更新

1) Go to Mongo DB download center https://www.mongodb.com/download-center#community and pick a flavor of MongoDB you want to install. 1) 转到 Mongo DB 下载中心https://www.mongodb.com/download-center#community并选择要安装的 MongoDB 版本。 You can pick from你可以从中挑选

  • MongoDB Atlas - MongoDB database in the cloud MongoDB Atlas - 云中的 MongoDB 数据库
  • Communiy Server - MongoDb for windows (with and without SSL),iOS, Linux Communiy Server - 适用于 Windows(带和不带 SSL)、iOS、Linux 的 MongoDb
  • OpManger - Mongo Db for Data Center OpManger - 用于数据中心的 Mongo Db
  • Compass - UI tool for MongoDB Compass - MongoDB 的 UI 工具

To know your OS version run this command in cmd prompt要了解您的操作系统版本,请在 cmd 提示符下运行此命令

wmic os get caption

To know your CPU architecture(32 or 64 bit) run this command in cmd prompt要了解您的 CPU 架构(32 位或 64 位),请在 cmd 提示符下运行此命令

wmic os get osarchitecture

I am using Community version (150MBs- GNU license)我使用的是社区版(150MBs- GNU 许可证)

2) Click on MSI and go through installation Process. 2) 单击 MSI 并完成安装过程。 Exe will install MongoDb and SSL required by the DB. Exe 将安装数据库所需的 MongoDb 和 SSL。

在此处输入图片说明

Mongo DB should be installed on your C drive Mongo DB 应该安装在你的 C 盘上

C:\\Program Files\\MongoDB C:\\Program Files\\MongoDB

MongoDB is self-contained, it means and does not have any other system dependencies. MongoDB 是自包含的,这意味着并且没有任何其他系统依赖项。 If you are low on disk in C drive then you can run MongoDB from any folder you choose.如果您的 C 盘磁盘空间不足,那么您可以从您选择的任何文件夹运行 MongoDB。

You can now run mongodb.exe from bin folder.您现在可以从 bin 文件夹运行 mongodb.exe。 If you get Visual C++ error for missing dlls then download Visual C++ Redistributable from如果您因缺少 dll 而收到 Visual C++ 错误,请从以下位置下载 Visual C++ Redistributable

https://www.microsoft.com/en-in/download/details.aspx?id=48145 https://www.microsoft.com/en-in/download/details.aspx?id=48145

After installation, try to rerun mongo.exe.安装后,尝试重新运行 mongo.exe。

您可能想检查https://github.com/Thor1Khan/mongo.git它使用了 64 位操作数上的 32 位原子操作的最小解决方法(可以使用汇编,但在这里似乎不是强制性的)只有数字错误在犯案前受到伤害

  1. Download .msi from https://www.mongodb.com/download-center#communityhttps://www.mongodb.com/download-center#community下载 .msi

  2. Double click install - complete option双击安装 - 完整选项

  3. Installation folder C:\\Program Files\\MongoDB\\Server\\3.6\\bin安装文件夹 C:\\Program Files\\MongoDB\\Server\\3.6\\bin

  4. Create database folder in C:// - c:/data/db and c:/data/log and c:/data/log/mongo.log and set write permission if not在 C:// - c:/data/db 和 c:/data/log 和 c:/data/log/mongo.log 中创建数据库文件夹,如果没有则设置写权限

  5. Open cmd prompt in Administrator mode , navigate to C:\\Program Files\\MongoDB\\Server\\3.6\\bin在管理员模式下打开 cmd 提示符,导航到 C:\\Program Files\\MongoDB\\Server\\3.6\\bin

  6. Type the following输入以下内容

    C:\\Program Files\\MongoDB\\Server\\3.6\\bin>mongod --dbpath="c:/data/db" --logpath="c:/data/log/mongo.log" C:\\Program Files\\MongoDB\\Server\\3.6\\bin>mongod --dbpath="c:/data/db" --logpath="c:/data/log/mongo.log"

  7. Check folder c:/data/db - there should be many files and folder检查文件夹 c:/data/db - 应该有很多文件和文件夹

  8. Create a config file named "mongo.config" ** inside C:\\data\\在 C:\\data\\ 内创建一个名为“mongo.config”** 的配置文件

  9. Type the following to set the config values from newly created config file键入以下内容以从新创建的配置文件中设置配置值

    C:\\Program Files\\MongoDB\\Server\\3.6\\bin>mongod --config C:\\data\\mongo.config C:\\Program Files\\MongoDB\\Server\\3.6\\bin>mongod --config C:\\data\\mongo.config

  10. Open another new cmd prompt in Administrator mode , navigate to C:\\Program Files\\MongoDB\\Server\\3.6\\bin execute the following lines on the console.在管理员模式下打开另一个新的 cmd 提示符,导航到 C:\\Program Files\\MongoDB\\Server\\3.6\\bin 在控制台上执行以下几行。

  11. Type the following to create service for MongoDB键入以下内容为 MongoDB 创建服务

    C:\\Program Files\\MongoDB\\Server\\3.6\\bin>mongod --install --config C:\\data\\mongo.config --logpath="c:/data/log/mongo.log" C:\\Program Files\\MongoDB\\Server\\3.6\\bin>mongod --install --config C:\\data\\mongo.config --logpath="c:/data/log/mongo.log"

    If old MongoDB service exists then need to delete the old service first before mongod --install command, run the following in a new console to delete old mongodb service如果旧的MongoDB服务存在则需要在mongod --install命令之前先删除旧的服务,在新的控制台中运行以下命令删除旧的mongodb服务

    SC STOP MongoDB SC 停止 MongoDB

     >> SC DELETE MongoDB
  12. Type the following to start MongoDB键入以下内容以启动 MongoDB

    C:\\Program Files\\MongoDB\\Server\\3.6\\bin>net start MongoDB C:\\Program Files\\MongoDB\\Server\\3.6\\bin>net start MongoDB

  13. Type the following to stop MongoDB键入以下内容以停止 MongoDB

    C:\\Program Files\\MongoDB\\Server\\3.6\\bin>net stop MongoDB C:\\Program Files\\MongoDB\\Server\\3.6\\bin>net stop MongoDB

Now connect the DB on ip - 127.0.0.1 or 192.168.5.64 on port 27017 .现在在端口 27017 上连接 ip - 127.0.0.1 或 192.168.5.64 上的数据库。

** File name - "mongo.config" , paste the following on config file - ** 文件名 - "mongo.config" ,在配置文件中粘贴以下内容 -

bind_ip = 127.0.0.1,192.168.5.64 bind_ip = 127.0.0.1,192.168.5.64

port = 27017端口 = 27017

dbpath=C:\\data\\db dbpath=C:\\data\\db

logpath=C:\\data\\log\\mongo.log日志路径=C:\\data\\log\\mongo.log

Install MongoDB Community Edition for Windows.安装适用于 Windows 的 MongoDB 社区版。

1.Now go to Download Center . 1.现在去下载中心

  1. The Download Center should display the Current Stable Release for Windows下载中心应显示适用于 Windows 的当前稳定版本

  2. Click Download (msi) and run it单击下载 (msi) 并运行它

  3. When you go through You can choose either the Complete or Custom setup type.当您完成时,您可以选择完整或自定义设置类型。 Select Complete Setup.选择完成设置。

Starting MongoDB server from the Command Prompt从命令提示符启动 MongoDB 服务器

1.Add this path to environmental variables 1.将此路径加入环境变量

“C:\\ProgramFiles\\MongoDB\\Server\\4.0\\bin” For those who struggle to setup environmental variable please follow this steps “C:\\ProgramFiles\\MongoDB\\Server\\4.0\\bin” 对于那些努力设置环境变量的人,请按照以下步骤操作

  • Windows 10 and Windows 8 Windows 10 和 Windows 8

  • In Search, search for and then select: System (Control Panel)在搜索中,搜索并选择:系统(控制面板)

  • Click the Advanced system settings link.单击高级系统设置链接。

  • Click Environment Variables.单击环境变量。 In the section System Variables, find the PATH environment variable and select it.在 System Variables 部分,找到 PATH 环境变量并选择它。 Click Edit.单击编辑。

  • If the PATH environment variable does not exist, click New.如果 PATH 环境变量不存在,请单击新建。

  • In the Edit System Variable (or New System Variable) window, specify the value of the PATH as “C:\\ProgramFiles\\MongoDB\\Server\\4.0\\bin”environment variable.在 Edit System Variable(或 New System Variable)窗口中,将 PATH 的值指定为“C:\\ProgramFiles\\MongoDB\\Server\\4.0\\bin”环境变量。

  • Click OK.单击确定。

  • Close all remaining windows by clicking OK.单击确定关闭所有剩余的窗口。

  • Now create MongoDB Data Directory MongoDB requires a data directory to store all data.现在创建 MongoDB 数据目录 MongoDB 需要一个数据目录来存储所有数据。 Open Command Prompt and paste below打开命令提示符并粘贴到下面

md "C:\\data\\db" "C:\\data\\log"

3.Lets point server to your database directory.Type below code 3.让服务器指向您的数据库目录。键入以下代码

mongod --dbpath="c:\\data\\db"

4.Now lets connect to MongoDB Type below code 4.现在让我们连接到 MongoDB 键入下面的代码

mongo蒙戈

5.If it is working properly Command prompt will show 5.如果它工作正常命令提示符将显示

[initandlisten] waiting for connections [initandlisten] 等待连接

Bingo!!答对了!! You are done, Apparently it is bit confusing to use CLI, well MongoDB introduced a GUI which you can see the actual data ,大功告成,显然使用 CLI 有点混乱,MongoDB 引入了一个 GUI,您可以看到实际数据,

To use mongoDB GUI version Above steps must have been performed使用 mongoDB GUI 版本以上步骤必须已经执行

  1. Now go to Download Center.现在去下载中心。 Download MongoDb Compass ,a GUI for MongoDB下载 MongoDb Compass,一个用于 MongoDB 的 GUI
  2. Install it and open安装并打开

You can see the hostname : localhost and port : 27017.您可以看到主机名:localhost 和端口:27017。

Whenever you wanted to connect to mongoDB Server , You have to open Command prompt每当你想连接到 mongoDB 服务器时,你必须打开命令提示符

Type类型

mongod蒙哥

then again start a new Command prompt and type然后再次启动一个新的命令提示符并键入

mongo蒙戈

Keep 'em all settings as it is in mongoDB Compass.将所有设置保持在 mongoDB Compass 中。 Now click connect ,现在点击连接,

You are in !!你在!! Easy .. isn't it?容易……不是吗?

Step 1: First download the .msi ie is the installation file from步骤 1:首先下载 .msi 即安装文件来自

Download MonggoDB 下载 MongoDB

Step 2: Perform the installation using the so downloaded .msi file.Automatically it gets stored in program files.第 2 步:使用如此下载的 .msi 文件执行安装。它会自动存储在程序文件中。 You could perform a custom installation and change the directory.您可以执行自定义安装并更改目录。

After this, you should be able to see a MongoDB folder under program files在此之后,您应该能够在程序文件下看到一个 MongoDB 文件夹

starting MongoDB shell and service is not big a deal I Got a good reference after the long search Installing MongoDB in Windows启动 MongoDB shell 和服务没什么大不了的,经过长时间的搜索,我得到了一个很好的参考在 Windows 中安装 MongoDB

  1. Download from http://www.mongodb.org/downloadshttp://www.mongodb.org/downloads下载
  2. Install .msi file in folder C:\\mongodb在文件夹 C:\\mongodb 中安装 .msi 文件
  3. Create data, data\\db, log directories and mongo.config file under C:\\mongodb.在 C:\\mongodb 下创建 data、data\\db、log 目录和 mongo.config 文件。
  4. Add the following lines in "mongo.config" file dbpath=C:\\mongodb\\data\\db\\ logpath=C:\\mongodb\\log\\mongo.log在 "mongo.config" 文件 dbpath=C:\\mongodb\\data\\db\\ logpath=C:\\mongodb\\log\\mongo.log 中添加以下几行
  5. Start server : mongod.exe --config="C:\\mongodb\\mongo.config"启动服务器:mongod.exe --config="C:\\mongodb\\mongo.config"

That's it !!!就是这样 !!!

WAMP = Windows + Apache + MySQL/MariaDB + PHP/Python/Perl WAMP = Windows + Apache + MySQL/MariaDB + PHP/Python/Perl

You can't use MongoDB in wamp.You need to install MongoDB separately wamp中不能使用MongoDB,需要单独安装MongoDB

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM