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 *