use sanhe
db.auth(‘sanhe‘,‘35DJqemUv72‘);
use admin
show dbs;
db.auth("root","[email protected]")
use admin
db.createUser({user: "root",pwd: "[email protected]",roles: [ { role: "userAdminAnyDatabase", db: "admin" } ]})
./mongo --auth
db.auth("myUserAdmin", "abc123")
> db.grantRolesToUser("myUserAdmin", [ { role: "read", db: "admin" } ])