【实战】docker 中 mongodump 备份报错 Failed: can‘t create session: could not connect to server: connection()
问题:
docker 中 mongodump 备份报错
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.
原因:
用户名或密码错误,或者没有填写
解决方案:
设置正确的用户名或密码
- --username root 用户名
- --password "xxxx" 密码
- --collection 1609045 表(集合)名称
- --db xph 数据库名
- --out /backup/20230719 备份输出目录
mongodump --authenticationDatabase admin --username root --password "xxx" --collection xx--db xph --out /backup/20230719