1. 认证
use admin
db.auth("管理员用户名", "管理员密码" )
2. 建库
use 新库名
db.createUser({user: "新库用户名",pwd: "新库密码",roles: [ { role: "dbAdmin", db: "新库名" },{ role: "readWrite", db: "新库名" }, { role: "read", db: "新库名" } ]})
1. 认证
use admin
db.auth("管理员用户名", "管理员密码" )
2. 建库
use 新库名
db.createUser({user: "新库用户名",pwd: "新库密码",roles: [ { role: "dbAdmin", db: "新库名" },{ role: "readWrite", db: "新库名" }, { role: "read", db: "新库名" } ]})