MongoDB 3.0 使用者建立
阿新 • • 發佈:2019-01-01
> use admin switched to db admin > db.auth('dba','dba') 1 > db.system.users.find().pretty() { "_id" : "admin.dba", "user" : "dba", "db" : "admin", "credentials" : { "SCRAM-SHA-1" : { "iterationCount" : 10000, "salt" : "KfDUzCOIUo7WVjFr64ZOcQ==", "storedKey" : "t4sPsKG2dXnZztVYj5EgdUzT9sc=", "serverKey" : "2vCGiq9NIc1zKqeEL6VvO4rP26A=" } }, "roles" : [ { "role" : "userAdminAnyDatabase", "db" : "admin" } ] } { "_id" : "test.zjyr", "user" : "zjyr", "db" : "test", "credentials" : { "SCRAM-SHA-1" : { "iterationCount" : 10000, "salt" : "h1gOW3J7wzJuTqgmmQgJKQ==", "storedKey" : "7lkoANdxM2py0qiDBzFaZYPp1cM=", "serverKey" : "Qyu6IRNyaKLUvqJ2CAa/tQYY36c=" } }, "roles" : [ { "role" : "read", "db" : "test" }] } { "_id" : "test.zjy", "user" : "zjy", "db" : "test", "credentials" : { "SCRAM-SHA-1" : { "iterationCount" : 10000, "salt" : "afwaKuTYPWwbDBduQ4Hm7g==", "storedKey" : "ebb2LYLn4hiOVlZqgrAKBdStfn8=", "serverKey" : "LG2qWwuuV+FNMmr9lWs+Rb3DIhQ=" } }, "roles" : [ { "role" : "readWrite", "db" : "test" } ] } { "_id" : "admin.zhoujinyi", "user" : "zhoujinyi", "db" : "admin", "credentials" : { "SCRAM-SHA-1" : { "iterationCount" : 10000, "salt" : "pE2cSOYtBOYevk8tqrwbSQ==", "storedKey" : "TwMxdnlB5Eiaqg4tNh9ByNuUp9A=", "serverKey" : "Mofr9ohVlFfR6/md4LMRkOhXouc=" } }, "roles" : [ { "role" : "root", "db" : "admin" } ] } { "_id" : "admin.dxy", "user" : "dxy", "db" : "admin", "credentials" : { "SCRAM-SHA-1" : { "iterationCount" : 10000, "salt" : "XD6smcWX4tdg/ZJPoLxxRg==", "storedKey" : "F4uiayykHDp/r9krAKZjdr+gqjM=", "serverKey" : "Kf51IU9J3RIrB8CFn5Z5hEKMSkw=" } }, "roles" : [ { "role" : "readWrite", "db" : "test" }, { "role" : "readWrite", "db" : "abc" } ] } > db.system.users.find().count() 5