MONGO 远程连接服务器,出现:

PHP Fatal error:  Uncaught exception 'MongoConnectionException' with message 'Failed to connect to: 63.141.xx.xxx:27017: Authentication failed on database 'admin' with username 'xxx': auth fails' in /var/www/data/update_data.php:
Stack trace:# /var/www/data/update_data.php(): Mongo->__construct('mongodb://seole...')
# {main}
Authentication failed on database 'admin' with username

我明明连接的是XXX数据集合。 不是admin数据库。为毛出现连接Admin失败。

GOOGLE,原来是有些版本的mongo 搭配 linux后,如果不指定连接数据集,默认连接的是admin数据集,所以在连接字符串中就得指明要连接数据集。

代码由
$mongo_server = "mongodb://username:passwd@63.141.xx.xxx:27017";
$m_f = new Mongo($mongo_server); //
$db_f = $m_f->eTao;
$collection_f = $db_f->etao_data; 改为 $mongo_server = "mongodb://username:passwd@63.141.xx.xxx:27017/eTao";
$m_f = new Mongo($mongo_server); //
$db_f = $m_f->eTao;
$collection_f = $db_f->etao_data;

UBUNTU下MONGODB出现PHP Fatal error: Uncaught exception 'MongoConnectionException' with message 和 Authentication failed on database 'admin' with username的更多相关文章

  1. DVWA--登录页面错误问题 469 | | PHP Fatal error: Uncaught exception 'PDOException' with message 'could not find driver' in C:\web\DVWA\dvwa\includes\dvwaPage.inc.php:469

    // MySQL PDO Prepared Statements (for impossible levels) $db = new PDO('mysql:host=' . $_DVWA[ 'db_s ...

  2. php错误:Uncaught exception com_exception with message Failed to create COM object

    本文为大家讲解的是php错误:Uncaught exception com_exception with message Failed to create COM object,感兴趣的同学参考下. ...

  3. Uncaught exception 'PDOException' with message 'SQLSTATE[HY000] [2002] No such file or directory解决方法

    今天用pdo连接mysql遇到一个奇怪的问题,host设为127.0.0.1可以连接成功,设为localhost就会报如下的错误: PHP Fatal error:  Uncaught excepti ...

  4. windows redis:Uncaught exception 'RedisException' with message 'Redis server went away'

    window-exe-redis-2.8.12服务,当你复制好php_igbinary.dll,php_redis.dll时候,你运行redis报错:Fatal error: Uncaught exc ...

  5. Fatal error: Uncaught SoapFault exception

    Warning: SoapClient::SoapClient() expects parameter 2 to be array, boolean given in  login\login.php ...

  6. PHP-问题处理Fatal error: Uncaught Error: Call to undefined function mb_strlen()

    1.问题 今天重新安装了ubuntu,PHP,MySQL,Apache,到测试CMS项目时发生一个错误: Fatal error: Uncaught Error: Call to undefined ...

  7. PHP-问题处理Fatal error: Uncaught Error: Call to undefined function simplexml_load_file()

    1.问题 今天重新安装了ubuntu,PHP,MySQL,Apache,到测试CMS项目时发生一个错误: Fatal error: Uncaught Error: Call to undefined ...

  8. Fatal error: Uncaught Error: Call to a member function bind_param() on boolean

    1.2019年10月22日 PHP写mysqli 预编译查询的时候报错. Fatal error: Uncaught Error: Call to a member function bind_par ...

  9. PHP Fatal error: Uncaught Error: Call to undefined function pcntl_fork().. 开启php pcntl扩展实现多进程

    在使用函数pcntl_fork()时报错  Fatal error: Uncaught Error: Call to undefined function pcntl_fork()....,原因是没有 ...

随机推荐

  1. <a href=“#”>

    在html中看到这样的属性:<a href=“#”>搜了好久,感觉不甚明白,现记之,等遇到了再做补充. # is called an anchor (or hash...). so the ...

  2. Easy CHM使用简明教程

    近日整理硬盘,发现下载有许多DOC.JPEG.HTML等 格式的学习资料,也包括一些电子书资料:而其中的DOC.HTML等资料在学习浏览时显得很不方便,不同格式的文件需要使用不同的打开方式.近而发现电 ...

  3. web service 项目 和 普通 web项目 的 区别

    web service 面向的是开发者(需要再次开发) 普通web 面向的是用户(直接使用)

  4. Linux上查看造成IO高负载的进程

    方法1:使用iotop工具这是一个python脚本工具,使用方法如:iotop -o方法2:使用工具dmesg使用dmesg之前,需要先开启内核的IO监控:echo 1 >/proc/sys/v ...

  5. WriteableBitmap(二) 实例

    使用前面定义的WriteableBitmap,我们可以很容易地创建一个足够容纳整个100 x 100图像的数组: byte[] pixels = new byte[wbmap.PixelHeight* ...

  6. WCF客户端第一请求server特别慢,解决办法

    最近开发WCF应用的客户端,第一连接WCF后,请求数据返回的速度特别慢,不知道原因如何.最后改了下系统生成的APP.Config文件就好了,原来没有useDefaultWebProxy的选项,没有的时 ...

  7. CAS实战の遇到的问题

    1.客户端启动报错,报错信息如下: 严重: Exception starting filter CAS Single Sign Out Filter java.lang.IllegalArgument ...

  8. asp.net 网站监控方案

    前言:监控web网站方法有很多种,这篇文章说一下对windows服务器 asp.net网站的监控 采用的方案,Powershell + Influxdb + Grafana 1.PowerShell ...

  9. leetcode 第三大的数

    给定一个非空数组,返回此数组中第三大的数.如果不存在,则返回数组中最大的数.要求算法时间复杂度必须是O(n). 示例 1: 输入: [3, 2, 1] 输出: 1 解释: 第三大的数是 1. 示例 2 ...

  10. PowerDesigner 生成C#实体模版代码

    操作步骤见:  https://blog.csdn.net/da454122373/article/details/54346217 最后的template 模版代码如下: .if (%isValid ...