MongoDB system Knowledge (11)

Source: Internet
Author: User

1. Lock unlock

Db.runcommand ({fsync:1,lock:1})

Unlock

Db.currentop ()

2. Data Repair

Db.repairdatabase ()

3. Db.createuser ({User: "Uspcat", pwd: "123", Roles:[{role: "Useradminanydatabase", DB: "Admin"}]})

 built-in Roles (built-in role):  1  .    Database user role: Read, readWrite;     2  . Database Management roles: DbAdmin, Dbowner, useradmin;  3  . Cluster Management role: Clusteradmin, Clustermanager, Clustermonitor, Hostmanager;  4   5   6  . Super User role: root  //  There are also several roles that indirectly or directly provide access to System Superuser (Dbowner, Useradmin, useradminanydatabase)  7 . Internal role: __system 
READ: Allows the user to read the specified database ReadWrite: Allows the user to read and write to the specified database dbadmin: Allows the user to execute administrative functions in the specified database, such as index creation, deletion, View statistics or Access System.profileuseradmin: Allows the user to write to the System.users collection and can create, delete, and manage user clusteradmin in the specified database: Only available in the admin database. Gives the user administrative privileges on all shards and replica set related functions. Readanydatabase: Only available in the Admin database, giving the user read access to all databases Readwriteanydatabase: Only available in the admin database, Give users read and write access to all databases Useradminanydatabase: Available only in the admin database, giving the user useradmin permissions to all databases Dbadminanydatabase: Only available in the admin database, Gives the user dbadmin permissions for all databases. Root: Available only in the admin database. Super account, Super privilege

4. Start the user

Db.auth ("Uspcat", "123") \

5. Delete a user

Db.system.users.remove ({User: "Uspcat"})

MongoDB system Knowledge (11)

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.