0% found this document useful (0 votes)
11 views1 page

MongoDB - Create Additional Users For Specific Database

Uploaded by

manjunath61
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views1 page

MongoDB - Create Additional Users For Specific Database

Uploaded by

manjunath61
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

Create additional users for specific database

Whereas:
deika - database name
appuser - user account

> use deika;


switched to db deika
> db.createUser(
{
user: "appuser",
pwd: passwordPrompt(),
roles: [{role: "readWrite",db: "deika" },
{role : "read", db: "reporting" } ]
}
);

Enter password:
Successfully added user: {
"user" : "appuser",
"roles" : [
{
"role" : "readWrite",
"db" : "deika"
},
{
"role" : "read",
"db" : "reporting"
}
]
}
>

Login to mongo shell


Syntax: mongo --port 27017 --authenticationDatabase "databaesname" -u "username" -
p
Example: mongo --port 27017 --authenticationDatabase "deika" -u "appuser" -p

You might also like