[MEMO] Setup admin and user in MongoDB version 4
[noauth]
/usr/local/mongo/bin/mongod --port 27017 --dbpath /usr/local/mongo/data/db --logpath /usr/local/mongo/var/log/mongod.log --logRotate rename --bind_ip_all --pidfilepath /usr/local/mongo/var/run/mongod.pid --noauth
[auth]
/usr/local/mongo/bin/mongod --port 27017 --dbpath /usr/local/mongo/data/db --logpath /usr/local/mongo/var/log/mongod.log --logRotate rename --bind_ip_all --pidfilepath /usr/local/mongo/var/run/mongod.pid --auth
use admindb.createUser({user: "admin",pwd: "XXXXXXXX",roles: [{ role: “userAdmin”, db: "admin" },{ role: "userAdminAnyDatabase", db: "admin" },{ role: “readWrite”, db: "admin" },{ role: “readWriteAnyDatabase”, db: "admin" },{ role: "clusterAdmin", db: "admin" },{ role: “dbAdmin", db: "admin" }{ role: “dbAdminAnyDatabase", db: "admin" }],passwordDigestor: "server"})
use marksix
db.createUser({
user: "marksix-dev",
pwd: "XXXXXXXX",
roles: [
{ role: "readWrite", db: "marksix" }
],
passwordDigestor: "server"
})
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home