MongoDB Add MongoDB service to the system __ database

Source: Internet
Author: User
Tags create mongodb install mongodb mongodb mongodb add

As a result of the recent learning Nodejs, when used to the database, the feeling MongoDB and Nodejs very well, all installation MongoDB try, by the way, more than the pressure on the body. about how to install MongoDB, I saw a lot of blog on the Internet have introduced, I have skipped here. OK, get to the point.

To add a MongoDB service to the system:

1, in the installation directory (my installation directory is D:\MongoDB) under a new DB folder as a database storage path, create a new log folder to store logs.

2, Win+x+a Open the Administrator command prompt, and use the following command to create a profile mongod.cfg.

echo Logpath=d:\mongodb\log\mongod.log>d:\mongodb\mongod.cfg

Echo dbpath=d:\mongodb\db>>d:\mongodb\ Mongod.cfg

One thing to note here is that if your path contains spaces, you can "" surround them, for example: Echo logpath= "D:\Program Files\mongodb\log\mongod.log" >d:\mongodb\ Mongod.cfg.

3, the use of SC command to create MongoDB services, the following command:

Sc.exe Create MongoDB binpath= "D:\MongoDB\bin\mongod.exe--service--config=d:\mongodb\mongod.cfg"


The illustration shows the MongoDB service creation success.

4, start the service

net start MongoDB


Appears as shown in the figure, indicating that the MongoDB service started successfully. You can win+r, enter services.msc to open a list of Windows services, and you can see MongoDB services.

At this point, you can start and stop the MongoDB service in the list of services.

5. Shutdown Service and Delete service

To turn off service usage commands:

net stop MongoDB

To delete a service usage command:

Sc.exe Delete MongoDB

Of course, you can also operate in the list of services.

The above is about how to add a MongoDB service to the system without having to open a DOS window more.

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.