創建用戶:
db.createUser({user:"myAdmin",pwd:"666666",roles:[{role:"userAdminAnyDatabase",db:"admin"}]})
驗證是否成功:
db.auth({user: "myAdmin", pwd: "666666"})
停止服務:
net stop Mongodb
開啓服務:
net start Mongodb
創建用戶:
db.createUser({user:"myAdmin",pwd:"666666",roles:[{role:"userAdminAnyDatabase",db:"admin"}]})
驗證是否成功:
db.auth({user: "myAdmin", pwd: "666666"})
停止服務:
net stop Mongodb
開啓服務:
net start Mongodb