※便笺※ Bitnami MEAN(MongoDB密码重置)
编辑/opt/bitnami/mongodb/mongodb.conf文件,并替换以下行:
# Turn on/off security. Off is currently the default
#noauth = true
auth = true
# Disable the HTTP interface (Defaults to localhost:27018).
#nohttpinterface = true
setParameter = enableLocalhostAuthBypass=0
使用
# Turn on/off security. Off is currently the default
noauth = true
#auth = true
# Disable the HTTP interface (Defaults to localhost:27018).
#nohttpinterface = true
#setParameter = enableLocalhostAuthBypass=0
重新启动MongoDB服务器。
cd /opt/bitnami
sudo /opt/bitnami/ctlscript.sh restart mongodb
创建一个具有新密码的新管理用户。运行以下命令来执行此操作(记得用你想要设置的新密码替换NEWPASSWORD):
mongo
> db = db.getSiblingDB('admin')
admin
> db.changeUserPassword("root", "NEWPASSWORD")
通过替换,还原对 /opt/bitnami/mongodb/mongodb.conf 进行的修改。
# Turn on/off security. Off is currently the default
noauth = true
#auth = true
# Disable the HTTP interface (Defaults to localhost:27018).
#nohttpinterface = true
#setParameter = enableLocalhostAuthBypass=0
与
# Turn on/off security. Off is currently the default
#noauth = true
auth = true
# Disable the HTTP interface (Defaults to localhost:27018).
#nohttpinterface = true
setParameter = enableLocalhostAuthBypass=0
重新启动 MongoDB 服务器:
cd /opt/bitnami
sudo /opt/bitnami/ctlscript.sh restart mongodb