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)
This should work.
mongodump -h SERVER_NAME:PORT -d DATABASE_NAME -u DATABASE_USER -p PASSWORD
Also this error can popup if username or password are wrong.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With