mongodb 错误 SCRAM-SHA-1 authentication failed for --转
问题:
执行 db.auth(‘username’, ‘password’),
monoDB 认证失败,
出现 SASL SCRAM-SHA-1 authentication failed for nls-cloud on admin from client 172.19.0.1:14500 ; UserNotFound: Could not find user
环境
root、admin、和业务数据库用户都认证失败了
解决方案
停止MongoDB,用无身份认证方式打开,
##进入bin目录下, cd ##停止 mongod --shutdown --dbpath=/soft/mongo/mgserver/data/ ##启动 ./mongod --dbpath=/soft/mongo/mgserver/data/ --logpath=/soft/mongo/mgserver/logs/mongod.log --logappend --port=27017 --fork
查证
mongo show dbs use ${your db} show users use admin show users
同理修改其他用户密码
修改密码
3.1 修改root密码:
# mongo # db.changeUserPassword(‘root‘,‘${new password}‘) # exit退出 #关闭 mongod --shutdown --dbpath=/soft/mongo/mgserver/data/ #认证启动 ./mongod --dbpath=/soft/mongo/mgserver/data/ --logpath=/soft/mongo/mgserver/logs/mongod.log --auth --logappend --port=27017 --fork # mongo # use admin #user, pwd db.auth(‘‘,‘‘)
3.2 新增用户
# mongo # use ${your db} # db.createUser({ user: "", pwd:"", roles:[{role:"readWrite",db:""}] })
相关推荐
lbyd0 2020-11-17
BigYellow 2020-11-16
sushuanglei 2020-11-12
我心似明月 2020-11-09
zhushenghan 2020-11-09
sunnnyduan 2020-10-16
不要皱眉 2020-10-14
xiaohai 2020-09-29
songxiugongwang 2020-09-22
萌亖 2020-09-17
LuckyLXG 2020-09-08
sdmzhu 2020-09-01
mkhhxxttxs 2020-09-16
xiaohai 2020-09-16
newcome 2020-09-09
jaylong 2020-08-19
大秦铁骑 2020-08-19
thatway 2020-08-19