1use admin
2db.createUser({ user: "mongoadmin" , pwd: "mongoadmin", roles: ["userAdminAnyDatabase", "dbAdminAnyDatabase", "readWriteAnyDatabase"]})
1use admin
2db.createUser(
3 {
4 user: "username",
5 pwd: "password",
6 roles: [ "root" ]
7 }
8 )
9
1use admin
2db.createUser({
3 user: "username",
4 pwd: "password",
5 roles: [ "root" ]
6})