use mydb db.createUser( { "user" : "sa", "pwd": "sa", "customData" : { employeeId: 12345 }, "roles" : [ { role: "clusterAdmin", db: "admin" }, { role: "readAnyDatabase", db: "admin" }, "readWrite" ] }, { w: "majority" , wtimeout: 5000 } ) mongo -u sa -p sa --authenticationDatabase mydb
时间: 2024-10-07 03:20:26