Code in this video_How to Secure MongoDB with Username and Password on Linux

Code in this video_How to Secure MongoDB with Username and Password on Linux

📌 Replace the highlighted orange section with your information

db.createUser(
  {
    user: "Your-Username",
    pwd: "Your-Password",
    roles: [ { role: "Your-Role", db: "admin" } ]
  }
)

Your-Role

	userAdminAnyDatabase
 or root

db.createUser(
  {
    user: "Your-Username",
    pwd: "Your-Password",
    roles: [ { role: "userAdmin", db: "Your-Database" } ]
  }
)

	authorization: "enabled"

Leave a Reply

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