mongodb 使用mongodump备份 指定用户名密码 出现错误


mongodb 使用mongodump备份 指定用户名密码 出现错误 

[root@MongoDB ~]# mongodump --host 127.0.0.1 --port 27017 -u admin -p 123456 -d db1 -o /root/
 Failed: error connecting to db server: server returned error on SASL authentication step: Authentication failed

 

解决方法:

添加--authenticationDatabase admin

 

 

 

 

 

再次备份,备份成功

 

[root@MongoDB ~]# mongodump --host 127.0.0.1 --port 27017 -u admin -p 123456 -d db1 -o /tmp/mongobak --authenticationDatabase admin
writing db1.user to 
writing db1.chat to 
done dumping db1.user (3 documents)
done dumping db1.chat (3 documents)


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM