dbAdmin 不等于 root 集合中角色

dbAdmin  root  集合中角色

 

 

use admin
创建
db.createUser(
{
user: "tmp_rw_56756",
pwd: "tmp4242vdfd",
roles: [ "readWrite", "dbAdmin" ]
}
)

repl_test:PRIMARY> db.system.users.find({})
{ "_id" : "admin.admin", "user" : "admin", "db" : "admin", "credentials" : { "SCRAM-SHA-1" : { "iterationCount" : 10000, "salt" : "V7VYUNDGexgVnKhvR1CWKQ==", "storedKey" : "H0gAXeCe1Twfqv6psI9+9Ul3bXI=", "serverKey" : "etgetLycgvSVeDJlWR6XFcikF3o=" } }, "roles" : [ { "role" : "root", "db" : "admin" } ] }
{ "_id" : "personas.guest", "user" : "guest", "db" : "personas", "credentials" : { "SCRAM-SHA-1" : { "iterationCount" : 10000, "salt" : "CEEWhTzFVPuqVP0/WkLs4w==", "storedKey" : "gvaXHeevGTGa0ptc0OyokS1SXXo=", "serverKey" : "ZfXCqeLKqnrzlpbcvFIOFpCP/zw=" } }, "roles" : [ { "role" : "read", "db" : "personas" } ] }
{ "_id" : "admin.tmp_rw_56756", "user" : "tmp_rw_56756", "db" : "admin", "credentials" : { "SCRAM-SHA-1" : { "iterationCount" : 10000, "salt" : "4oNrmGqCe+tISkmz7zGadg==", "storedKey" : "81P26DcNYgDWJaDlho4IOTt+d50=", "serverKey" : "6PCv81p747XO1FCInHof7U6RXS8=" } }, "roles" : [ { "role" : "readWrite", "db" : "admin" }, { "role" : "dbAdmin", "db" : "admin" } ] }
repl_test:PRIMARY>

删除用户
repl_test:PRIMARY> db.runCommand( {
... dropUser: "tmp_rw_56756",
... } )
{ "ok" : 1 }
repl_test:PRIMARY> db.system.users.find({})
{ "_id" : "admin.admin", "user" : "admin", "db" : "admin", "credentials" : { "SCRAM-SHA-1" : { "iterationCount" : 10000, "salt" : "V7VYUNDGexgVnKhvR1CWKQ==", "storedKey" : "H0gAXeCe1Twfqv6psI9+9Ul3bXI=", "serverKey" : "etgetLycgvSVeDJlWR6XFcikF3o=" } }, "roles" : [ { "role" : "root", "db" : "admin" } ] }
{ "_id" : "personas.guest", "user" : "guest", "db" : "personas", "credentials" : { "SCRAM-SHA-1" : { "iterationCount" : 10000, "salt" : "CEEWhTzFVPuqVP0/WkLs4w==", "storedKey" : "gvaXHeevGTGa0ptc0OyokS1SXXo=", "serverKey" : "ZfXCqeLKqnrzlpbcvFIOFpCP/zw=" } }, "roles" : [ { "role" : "read", "db" : "personas" } ] }
repl_test:PRIMARY>


更新用户密码

 

posted @ 2018-12-28 16:43  papering  阅读(352)  评论(0编辑  收藏  举报