Can't create backup mongodump with --db. Authentication failed

后端 未结 14 911
深忆病人
深忆病人 2020-12-29 18:22

When I create backup of all databases in MongoDB (version 3):

mongodump --username bacUser --password 12345

It\'s OK. But when I try to cre

相关标签:
14条回答
  • 2020-12-29 18:54

    I was having this same problem when trying to dump my database info from mLab. It was happening because I had mongo 2.x locally and 3.x in mLab. Upgrading my local mongo to the same major version as mLab allowed me to do the dump, thus solving the problem.

    0 讨论(0)
  • 2020-12-29 18:54

    If you use the --uri option, you need to add authSource=admin as a parameter to your connection string (assuming your user is on the admin database)

    mongodump --uri="mongodb://user:pass@host1:27017,host2:27017,host3:27017/?replicaSet=rs0"
    

    Becomes:

    mongodump --db=test --uri="mongodb://user:pass@host1:27017,host2:27017,host3:27017/?replicaSet=rs0&authSoource=admin"
    
    0 讨论(0)
提交回复
热议问题