mongodb的admin数据库创建user

admin数据库

转到admin

use admin

创建管理员账号

db.createUser(
 {
 user: "username",
 pwd: "password",
 roles: [ "readWrite", "dbAdmin" ]
 }
 )

查看是否创建成功这个账号

db.auth("username","password")