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)
[root@MongoDB ~]# lsdb1

 

转载于:https://www.cnblogs.com/mingerlcm/p/10701745.html

Logo

北京人形旗下天工造物具身智能开源社区,聚焦具身天工与慧思开物两大平台

更多推荐