MongoDB Learning Notes Rights Management Basics

Source: Internet
Author: User

Rights Management Basics

MongoDB has a lot of user roles, here is simply to enumerate the use of commands, specific role meaning, please check the official documentation.

Https://docs.mongodb.com/manual/reference/built-in-roles/#userAdmin

Before you enable permission validation, you need to restart the service to turn on Auth:

Examples of command use:

Use admin;

#创建用户, there are different methods for MONGO 3 and MONGO 2.

Db.createuser ({User: ' sky ', pwd: ' CSL ', roles:[' root ')});

Pkill-9 MONGO

#显示当前所在的库

db

Use test;

Db.createuser ({User: ' Test ', pwd: ' Test ', Roles:[{role: ' DbAdmin ', DB: ' Test '}]});

#权限验证, the equivalent of a user login.

Db.auth (' Test ', ' test ');

#修改密码

Db.changeuserpassword (' Test ', ' test123 ')

#删除用户

Db.dropuser (' Test ');

MongoDB Learning Notes Rights Management Basics

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.