douzhuanqian8244 2016-08-03 12:47 采纳率: 100%
浏览 1777
已采纳

服务器在SASL身份验证步骤上返回错误:身份验证失败

The following is my MongoDB connection dial from GoLang. But it's returning a panic "server returned error on SASL authentication step: Authentication failed.". My username, password, hostAddrs and dbName are correct. What am I missing here?

dbName: = os.Getenv("ENV_DBNAME")
userName: = os.Getenv("ENV_DBUSER")
password: = os.Getenv("ENV_DBPASS")
dbHost: = os.Getenv("ENV_DBHOST")
mongoDialInfo: = & mgo.DialInfo {
 Addrs: [] string {
  dbHost
 },
 Database: dbName,
 Username: userName,
 Password: password,
 Timeout: 60 * time.Second,
}
sess, err: = mgo.DialWithInfo(mongoDialInfo)
if (err != nil) {
 panic(err)

}
  • 写回答

7条回答 默认 最新

  • dpzbzp8728 2017-05-03 01:30
    关注

    I faced similar error and added --authenticationDatabase parameter and it worked while we connecting to a remote MongoDB

    Use the similar below format in your code :

    $mongorestore --host databasehost:98761 --username restoreuser
    --password restorepwd --authenticationDatabase admin --db targetdb ./path/to/dump/
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(6条)

报告相同问题?

悬赏问题

  • ¥40 复杂的限制性的商函数处理
  • ¥15 程序不包含适用于入口点的静态Main方法
  • ¥15 素材场景中光线烘焙后灯光失效
  • ¥15 请教一下各位,为什么我这个没有实现模拟点击
  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码