When I create backup of all databases in MongoDB (version 3):
mongodump --username bacUser --password 12345
It's OK. But when I try to create backup of a selected db:
mongodump --username bacUser --password 12345 --db test
It gives me this error:
Failed: error connecting to db server: server returned error on SASL authentication step: Authentication failed.
work with this:
--authenticationDatabase admin
mongodump and mongorestore commands need the name of database where mongodb user's credentials are stored. (thanks @Zubair Alam)