mongodb进行操作时,出现errmsg" : "not authorized on test to execute command { listCollections: 1.0 }这个提示
配置文件:#auth=true
添加用户--必须是root
use admin
db.createUser(
{
user: "vincent",
pwd: "111",
roles: [ { role: "root", db: "admin" } ]
}
)
配置文件:auth=true
重启
用vincent账号登录
use admin
db.auth('vincent','111');
评论