> db.addUser('sa','sa') { "user" : "sa", "readOnly" : false, "pwd" : "75692b1d11c072c6c79332e248c4f699", "_id" : ObjectId("53af835ada88ac42a40917a0") } > db.system.users.find() { "_id" : ObjectId("53af835ada88ac42a40917a0"), "user" : "sa", "readOnly"...
userAdminAnyDatabase:具有userAdmin每一个数据库权限,但是不包括应用到集群中的数据库。 dbAdminAnyDatabase:提供了dbAdmin每一个数据库权限,但是不包括应用到集群中的数据库。 (5). 超级管理员权限 root: dbadmin到admin数据库、useradmin到admin数据库以及UserAdminAnyDatabase。但它不具有备份恢复、直接操作system....
db.addUser({user:'normaluser',pwd:'password',roles:["read"]) 参考文档: 2.6之后版本 ## MongoDB shell version: 2.6.* ## admin用户 use admin db.createUser({ user:'root', pwd:'password', roles:[ { role:"dbAdminAnyDatabase", db:"admin" }, { role:"userAdminAnyDatabase", ## 任...
"salt" : "PJPZSCq9YqY96QOWgVPnRQ==", "storedKey" : "VAO+Now5XIzkmewkRFr3TIKU6J0=", "serverKey" : "9V2ArT9CWsunH8TCk/lY1oCAUzk=" } }, "roles" : [ { "role" : "userAdminAnyDatabase", "db" : "admin" } ] }
connecting to: test > show dbs local0.078125GB > use admin switched to db admin > db.addUser("zhuima","zhuima") { "user" : "zhuima", "readOnly" : false, "pwd" : "214c77cbc6bc7d26f28022c30496223d", "_id" : ObjectId("53cbcb3cc5761ac13c7f6614") ...
db.AddUser(username,password) 添加用户 db.auth(usrename,password) 设置数据库连接验证 db.cloneDataBase(fromhost) 从目标服务器克隆一个数据库 db.commandHelp(name) returns the help for the command db.copyDatabase(fromdb,todb,fromhost) 复制数据库fromdb---源数据库名称,todb---目标数据库名称,fromho...
I am trying to create user for my mongo database. Using MongoDB Query: db.createUser({user: 'administrator', pwd: '1234567890', roles: ['root']}) 2019-01-29T11:31:32.521+0530 E QUERY [js] Error: couldn't add user: No role named root@test : mongod.config there is no file ...
mongodb安装完成后并没有设置账号,所以需要连接数据库设置初始账号。没有账号的数据库可以通过本地例外进行账号创建,一旦设置账号或角色,访问控制将起作用,通过本地例外添加账号的功能将禁用,所以需要先在admin库中创建有管理员权限的账号,如userAdmin或userAdminAnyDatabase。
mkdir/opt/mongodb/{data,logs}useradd mongodb # 我们这里使用的配置文件 是YAML格式的 wget https://raw.githubusercontent.com/tobewithyou1996/LinuxGuide/master/MongoDB/mongodb_rep.yaml-P/opt/mongodb/chown-Rmongodb:mongodb/opt/mongodb/cat<<EOF>>/usr/lib/systemd/system/mongodb.service[Unit]...
2022-08-05T09:17:59.537+00:00: Access control is not enabled for the database. Read and write access to data and configuration is unrestricted 2022-08-05T09:17:59.537+00:00: You are running this process as the root user, which is not recommended ...