mongodb create admin user


Mongodb 3:
use admin
db.createUser(
{
user: "username",
pwd: "password",
roles: [ "root" ]
}
)

MongoDB older:

db.createUser({ user: "mongoadmin" , pwd: "mongoadmin", roles: ["userAdminAnyDatabase", "dbAdminAnyDatabase", "readWriteAnyDatabase"]})< /code>

Leave a Reply

Your email address will not be published. Required fields are marked *