mongoDB创建新用户db.createUser(
{
user: "yingbo",
pwd: "",
roles: [ { role: "dbAdmin", db: "yingbo" },{ role: 'readWrite', db: "yingbo"} ]
}
)
db.createUser(
{
user: "admin",
pwd: "",
roles: [ { role: "userAdminAnyDatabase", db: "admin" } ]
}
)
log目录 /var/log/mongodb/mongod.logdb目录 /var/lib/mongo配置文件 /etc/mongod.conf启动/重启/停止 sudo service mongod start/restart/stop开启用户认证 c