• 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>


    更新用户密码

  • 相关阅读:
    可拖动面板
    mybatis generator 为数据库保留字段 转义
    SpringMVC全局异常处理
    java通过jdbc访问mysql,update数据返回值的思考
    资源查找器PathMatchingResourcePatternResolver的使用
    ant 通配符
    ffmpeg+libmp3lame库源码安装教程(CentOS)
    为Apache添加MP4扩展
    ffmpeg-php扩展
    ffmpeg编译错误,提示找不到相应的shared libraries :libavdevice.so.53
  • 原文地址:https://www.cnblogs.com/rsapaper/p/10191479.html
Copyright © 2020-2023  润新知