Installation of MongoDB on Windows

Source: Internet
Author: User
Tags mongodb

Download

Download MongoDB, naturally in his official website to download the corresponding version of the system, I downloaded the Windows installation package.

Installation

Fool-mounted, not much to say. (Installed on the C drive by default.) )

Start

MongoDB data exists in a data folder called folders, this folder is created by itself:

$ cd c:/$ mkdir data$ cd data$ mkdir db$ mkdir log

Now it's time to start MongoDB.

The command line enters the bin folder of the MongoDB installation directory. Run the command:

$ mongod dbpath "C:\data\db" --logpath "C:\data\log\mongodb.log"

The boot was successful without an accident.

However, when the command window is closed, MongoDB is also closed, which is not interesting.

So the MongoDB setting becomes the service of the system.

    • Registration Services

shell $ mongod --dbpath "C:\data\db" --logpath "C:\data\log\mongodb.log" --serviceName "MongoDB" --install

    • Start the service

This step, tried several times, you must run Cmd.exe as an administrator, and then execute the following command:

shell $ net start MongoDB

No accident, the MongoDB service started successfully.

Access

Now boot also started, how to operate the database?

The MongoDB installation directory under the Bin folder has one mongo.exe , as long as the command line to run this file is good:

$ cd C:\Program Files\MongoDB\Server\3.6\bin$ mongo

But it is not always possible to access the database every time you have to go into this folder, so C:\Program Files\MongoDB\Server\3.6\bin add to the system's PATH environment variable is good.

So, it's done!!!

Installation of MongoDB on Windows

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.