为mongodb中某一数据库添加用户名和密码

作者: Jancaelm 分类: 未分类 发布时间: 2018-01-09 22:27
use reporting
db.createUser(
  {
    user: "reportsUser",
    pwd: "12345678",
    roles: [
       { role: "read", db: "reporting" },
       { role: "read", db: "products" },
       { role: "read", db: "sales" },
       { role: "readWrite", db: "accounts" }
    ]
  }
)

发表评论

电子邮件地址不会被公开。 必填项已用*标注