mongodb3.x create user

1. It will be more convenient to use visualization tools, with hints

enter shell command mode



 

 

2. Switch to the database cxz that needs to be set

   use cxz

3. Add users

   db.createUser(

  {

    user: "cxz",

    pwd: "abc123",

    roles: [ { role: "dbOwner", db: "cxz" } ]

  }

)

 

----

4. Delete user

  db.dropUser("cxz")

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326177210&siteId=291194637