【实战】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

posted @ 2023-07-20 14:06  随风落木  阅读(8)  评论(0编辑  收藏  举报  来源