MongoDB Account Management (user name password settings) By default does not require the account password, in/etc/mongodb.conf set auth = True after restarting the account permission function. 1, create the admin Super Privilege: MONGO www.2cto.com use admin; Db.adduser (' root ', ' sa ') added root account, this time to execute show collections, the reality does not have permission, must first execute db.auth (' root ', ' sa '), return 1 to verify the success. Returns 0 indicating that the validation failed. When you log in directly to other tables, you must first use Admin;db.auth (' root ', ' sa '), then use Keke;show collections, or you will not have permissions. 2, if you want to access a single table, with a separate user name, you need to build the corresponding users in that table. MONGO Login, use Admin;db.auth (' root ', ' sa '), use Keke;db.adduser (' Keke ', ' test '); This time can be directly used Keke account login Keke database. MONGO use Keke;db.auth ("Keke", "Test"); show collections; right.
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.