MongoDB中修改密码和忘记密码的情况

MongoDB中修改密码和忘记密码的情况

对于忘记密码的情况,需要将mongod重启,并以auth=false的选项启动Mongod,之后就可以通过如下命令来修改密码:

 

db.changeUserPassword("用户名", "密码")

对于普通的修改密码,可以通过openssl生成随机密码并设置:

openssl rand -base64 48
db.changeUserPassword("reporting", "SOh3TbYhxuLiW8ypJPxmt1oOfL")

Posted

in

by

Tags:

Comments

Leave a Reply

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