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. HDU 1040 As Easy As A+B (排序。。。水题)

    题意:给定n个数,让你从小到大排序. 析:不说什么了. 代码如下: #include <cstdio> #include <iostream> #include <cst ...

  2. HDU 2719 The Seven Percent Solution (水题。。。)

    题意:把字符串中的一些特殊符号用给定的字符串代替. 析:没的说. 代码如下: #include <iostream> #include <cstdio> #include &l ...

  3. 批量远程执行shell命令工具

    使用示例(使用了默认用户root,和默认端口号22): ./mooon_ssh --h=192.168.4.1,192.168.4.2 -P=password -c='cat /etc/hosts' ...

  4. TableView编辑状态下跳转页面的崩溃处理

    29down votefavorite 12 I have a viewController with a UITableView, the rows of which I allow to edit ...

  5. IOS11下fixed中input光标错位问题

    项目遇到了这个问题,故作了个临时解决方案,暂时没有想到更好的方法,查阅了网上的方案,也没有找到完美的解决方案. 方案思路: ①弹窗打开时,阻止 body 滚动,禁用 touchmove ,同时记录当前 ...

  6. hdu 2086 A1 = ?(数学题)

    转载链接 因为:Ai=(Ai-1+Ai+1)/2 - Ci,        A1=(A0  +A2  )/2 - C1;       A2=(A1  +  A3)/2 - C2 , ... => ...

  7. Failed to get D-Bus connection: Operation not permitted

    通过centos7镜像创建了一个docker容器,并在容器中安装了一个apache服务,但是启动时发生如下报错 [root@1346963c2247 ~]# rpm -qa | grep httpdh ...

  8. paxos ---学习笔记

    摘自维基百科:分布式系统中的节点通信存在两种模型:共享内存(Shared memory)和消息传递(Messages passing).基于消息传递通信模型的分布式系统,不可避免的会发生以下错误:进程 ...

  9. kubernetes 应用基本准则

    不要直接部署裸的Pod. 为工作负载选择合适的Controller. 使用Init容器确保应用程序被正确的初始化. 在应用程序工作负载启动之前先启动service. 使用Deployment hist ...

  10. webapi 用腾讯云手机短信验证码

    #region 验证码相关 public class SmsSDK { #region 短信发送的必要参数 /// <summary> /// appId /// </summary ...