MongoDB installation, Windows services, creating users

Source: Internet
Author: User
Tags auth

Http://www.cnblogs.com/best/p/6212807.html

Open the MongoDB installation directory such as "C:\Program Files\mongodb\server\3.4\bin" and create a new Mongo.config file in this directory with the following file contents:

# #数据库目录 # #dbpath =c:\data\db# #日志输出文件 # #logpath =c:\data\log\db.log

Use CMD to enter the command line

Use the CD to switch directories to the installation directory, such as: CD C:\Program Files\mongodb\server\3.4\bin

Install the MongoDB service and specify the configuration file, such as:

Mongod--config "C:\Program files\mongodb\server\3.4\bin\mongo.config"--install

Http://www.cnblogs.com/yjq-code/p/6880625.html

There is no auth way to register and start the service, but this is not safe, generally start the service when the start of the Auth way, we will now create a new administrator user, in order to later start the service Auth way to prepare.

Input command: MONGO

Then enter the command in turn:

Use admin

Db.createuser ({User: "Yjq", pwd: "123456", roles:[{"role": "Useradmin", "db": "admin"},{"role": "Root", "db": "Admin"},{ "Role": "Useradminanydatabase", "db": "Admin"}]})

Be careful to change the corresponding user and pwd to the value you want.

Authorization to Account: Db.auth ("Yjq", "123456")

At this end a simple account authorization is over. Description of permissions See MongoDB 3.X User Rights control

MongoDB installation, Windows services, creating users

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.