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

后端 未结 14 982
深忆病人
深忆病人 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:46

    userAdminAnyDatabase is not enough to do mongodump on all the dbs that's why you are getting this error. You will need a super user that has:

    userAdminAnyDatabase
    readWriteAnyDatabase
    clusterAdmin
    

    privileges to run mongodump on all dbs.

    OR you just need 'backup' privilege

    db.grantRolesToUser('username', [{
      role: 'backup',
      db: 'name of ur authentication db'
    }])
    

提交回复
热议问题