当我在 MongoDB(版本 3)中创建所有数据库的备份时:
mongodump --username bacUser --password 12345
没关系。但是当我尝试创建所选数据库的备份时:
mongodump --username bacUser --password 12345 --db test
它给了我这个错误:
Failed: error connecting to db server: server returned error on SASL authentication step: Authentication failed.
最佳答案
使用这个:
--authenticationDatabase admin
mongodump 和 mongorestore 命令需要存储 mongodb 用户凭据的数据库名称。 (感谢@Zubair Alam)
https://stackoverflow.com/questions/31993168/