How to run Authentication on Mongodb
Step by step run Authentication on Mongodb
- start mongod.exe ( mongodb server)
- start mongo.exe (mongodb shell)
- set name db = admin
> use admin - create user supperadmin
> db.createUser(
{
user: "supperadmin", - Test Authentication
> db.auth("supperadmin","password") - close ( mongodb server)
- open mongodb server by command
mongod --auth - try reconnect mongodb server
mongo admin -u "supperadmin" -p "password"
pwd: "password",
roles: [ { role: "userAdminAnyDatabase", db: "admin" } ]
}
)
you can change permission by your self at role "permission", db: "dbname"
Ex
roles: [ { role: "readWriteAnyDatabase", db: "admin" } ]
or
user: "myTester", pwd: "xyz123", roles: [ { role: "readWrite", db: "test" }, { role: "read", db: "reporting" } ]
if success system will show like a below picture
Comments
Post a Comment