Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

mongodump from remote node - unable to authenticate using mechanism "SCRAM-SHA-256"

Tried taking dump from a remote node and got the following error:

Failed: can't create session: could not connect to server: connection(): auth error: sasl conversation error: unable to authenticate using mechanism "SCRAM-SHA-256": (AuthenticationFailed) Authentication failed.

Error Screenshot

Tried two methods to take dump from the remote node. But got the same error in both the methods.

# Method 1
mongodump -h remoteip@port -u xxx -p xxx --db xxx --authenticationDatabase xxx

# Method 2
mongodump --uri "mongodb://username:password@remoteip:port/db?authSource=xxx"

How to resolve this?

like image 606
Surya Avatar asked Dec 06 '22 08:12

Surya


1 Answers

For me (trying to use mongodump on a single node DB on the same host), using --authenticationDatabase admin did the trick:

mongodump -u root --password 'secret' --authenticationDatabase admin -d mongo-dev -o /tmp/dump-2020-11-27.bson


(courtesy of mongodump from remote node - unable to authenticate using mechanism "SCRAM-SHA-256")

like image 92
mmey Avatar answered May 11 '23 01:05

mmey