How to set username & password in MongoDB?

The easy way to set user name and password for a mongo db database:

use your_db_name
db.addUser(‘your_uesr_name’, ‘your_uesr_password’);
db.auth(‘your_uesr_name’, ‘your_uesr_password’);

That’s all…

If you need any more help please feel free to ask me. :)

Leave a Reply

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

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>