MongoDB Add Rights Management

Source: Internet
Author: User
Tags mongodb add

Preface:As the Columnstore concept matures, more and more developers are embracing mongodb,hbase, a large-storage, distributed, Columnstore database. In particular, MongoDB's rapid construction, the rapid use of features, so that it gets more people's favor. I mainly through the official website description for MongoDB permissions configuration to do a test and practice. Step1: No authentication start Mongod servicemongod--port 27017--dbpath/data/db1 step2: Client MONGO no password connection and set Superuser (for admin login)MONGO--port 27017Use Admindb.createuser (
  {
User: "Myuseradmin",
pwd: "abc123",
roles: [{role: ' Useradminanydatabase ', db: ' admin '}]
  }) Step3: There is a validation start Mongod servicemongod--auth--port 27017--dbpath/data/db1 step4: Administrator MONGO new user after login, assign permissionsMONGO--port 27017-u "Myuseradmin"-P "abc123"--authenticationdatabase "admin"Use Testdb.createuser (
  {
User: "Mytester",
pwd: "xyz123",
roles: [{role: ' ReadWrite ', DB: ' Test '},
{role: "read", DB: "Reporting"}]
  }) STEP5: Authorized user to log in and manipulate the table MONGO--port 27017-u "Mytester"-P "xyz123"--authenticationdatabase "test"Db.foo.insert ({x:1, y:1})Note: When no access is granted, the following error will be reported

Reference: https://docs.mongodb.com/v3.2/tutorial/enable-authentication/ post-language:The above is only for the simple management of MongoDB, not to be directly connected to the port by the outside world. But more systematic rights management also please refer to the official website description https://docs.mongodb.com/v3.2/tutorial/manage-users-and-roles/

MongoDB Add Rights Management

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.