thinkphp5 mongodb Authentication failed 解决办法

Bulk write failed due to previous MongoDB\Driver\Exception\AuthenticationException: Authentication failed.

原因是
/vendor/topthink/think-mongo/src/Connection.php文件中connect方法(大概189行左右)在拼接dns的时候缺少参数

$config['dsn'] = 'mongodb://' . ($config['username'] ? "{$config['username']}" : '') . ($config['password'] ? ":{$config['password']}@" : '') . $config['hostname'] . ($config['hostport'] ? ":{$config['hostport']}" : '');

dns格式是mongodb://username:passwd@localhost:3306/DbName?param1=val1&param2=val2#utf8参数补齐就行了

$config['dsn'] = 'mongodb://' . ($config['username'] ? "{$config['username']}" : '') . ($config['password'] ? ":{$config['password']}@" : '') . $config['hostname'] . ($config['hostport'] ? ":{$config['hostport']}" : '') . "/" . $config['database'] ;

thinkphp5 mongodb Authentication failed相关推荐

  1. mongodb php 报错,PHP5 mongodb 切换db报错 Authentication failed on database admin-汗血宝马

    权限 已经开启,在test上创建了用户test1,并赋予了 test的readWrite 和 reporting的read权限. { "_id" : "test.test ...

  2. spring.data.mongodb.uri认证失败Authentication failed

    使用spring.data.mongodb.uri=mongodb://root:ve#duj7-wa06yhg$@192.154.81.16:27017/xxxx老是出现Authentication ...

  3. ‘Authentication failed.‘ on server xx.xx.xxx.x:27017. The full response is { “ok“ : 0.0, “errmsg“

    异常产生环境 在SpringBoot项目中使用yml文件连接mongodb产生(mongodb带密码验证) 异常描述 com.mongodb.MongoCommandException: Comman ...

  4. db.auth(‘admin‘,‘123456‘) Error: Authentication failed. 0

    1.通过mongoDB compass连接地址:mongodb://admin:123456@localhost:27017/ 显示连接不上 2.那么我看一看通过命令行能不能连接,输入mongo可以连 ...

  5. mongodb-golang 权限验证报错:SASL authentication step: Authentication failed

    起因 1,今天在将服务查询db从mysql迁移至mongodb的时候,发现报错如下: {"level":"error","time":&qu ...

  6. { ok : 0.0, errmsg : Authentication failed., code : 18, codeName : AuthenticationFailed

    调用接口向mongoDB数据库写数据失败 背景:写了一个springboot整合mongoDB的小demo. 调用接口往数据库写入数据的时候,异常信息如下: com.mongodb.MongoComm ...

  7. 单点登录(十)-----遇到问题-----cas启用mongodb验证方式报错com.mongodb.CommandFailureException---Authentication failed

    cas启用mongodb验证方式报错com.mongodb.CommandFailureException---Authentication failed. 完整报错信息: 二月 08, 2017 5 ...

  8. git配置报错fatal: Authentication failed for ‘‘问题解决

    git配置报错fatal: Authentication failed for ''问题解决 参考文章: (1)git配置报错fatal: Authentication failed for ''问题 ...

  9. svn: E215004: Authentication failed

    Linux环境配置安装好SVN服务器后,输入命令: svn co svn:// IP : PORT 结果返回Authentication failed [root]@iZ23whn33Z conf]# ...

最新文章

  1. linux双网卡绑定+单网卡多IP绑定
  2. 人脸识别 python调用face++ 功能测试
  3. WinForm下的键盘事件(KeyPress、KeyDown)及如何处理不响应键盘事件
  4. .NET Core实战项目之CMS 第一章 入门篇-开篇及总体规划
  5. c程序怎么改为java程序_如何将Java程序的入口点更改为C签名?
  6. java布尔类型比较器_浅谈Java中几种常见的比较器的实现方法
  7. Win7下建立Wifi热点
  8. Python学习之OS模块初识
  9. POJ1061 青蛙的约会(拓展欧几里德)
  10. git上传代码前需要检查什么_肝功能检查前需要做什么准备?这6个要点需做好,以免准确度受影响...
  11. CloudComparePCL 主曲率、平均曲率以及高斯曲率计算
  12. double转换成百分数
  13. qpython3l_qpython3例子
  14. php企业微信回调url校验失败,企业微信第三方服务商回调URL无法通过验证
  15. C语言学习--01 认识数据类型
  16. 给自己:得失心莫太重,功利心莫太强
  17. php中可以表示当前日期的函数,在PHP中,可以使用()函数来获取当前日期和时间...
  18. 解决部署Hexo后出现的The custom domain for your GitHub Pages site is pointed at an outdated IP address警告
  19. Mac下的串口调试工具(2018更新)
  20. DOS DDOS DRDOS原理

热门文章

  1. R语言学习笔记2——基础绘图
  2. 单片机课程设计数字心率计_基于单片机的数字心率计设计
  3. 责任链模式在复杂数据处理场景中的实战
  4. Python趣味百题-初级篇-刘硕-专题视频课程
  5. 安卓Activity详解
  6. 什么牌子的降噪耳机好?商务蓝牙耳机排行榜
  7. 人和猴子没有可比性:从3个层面深度剖析UNI和CEX平台币的本质区别
  8. java包无法打开变成压缩包的解决办法
  9. android中拍照功能介绍,Android实现拍照功能
  10. Java基本数据类型详解(为什么byte的范围是-2^7 ~ 2^7-1?)