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. Swift的Optional类型

    我们使用Swift这个苹果新推出的编程语言已经有一段时间了.其中的一个极大的优点就是苹果称为“optional types”的东西.几乎所有的objective-c程序员都知道用nil来表示某个引用类 ...

  2. 整理iOS9适配中出现的坑

    一.NSAppTransportSecurity iOS9让所有的HTTP默认使用了HTTPS,原来的HTTP协议传输都改成TLS1.2协议进行传输.直接造成的情况就是App发请求的时候弹出网络无法连 ...

  3. Airplace平台

    Demo: 左上角:(0, 0)开始导航,手机终端上实时在地图上当前所在显示,当前点以绿色点显示,轨迹点以红色显示. 系统架构:基于移动手机的以网络为辅助的架构.特点:低头顶交流,用户隐私和安全 &g ...

  4. handsontable 问题

    碰到问题了,去官网上找community:http://docs.handsontable.com/0.16.1/tutorial-quick-start.html 1. 描述:把handson ta ...

  5. Android之ubuntu源码开发环境搭建笔记

    昨天,把电脑主机全换了,因此之前的工作环境得重新搭建,我是既开心又纠结,开心的是可以用高配置的电脑,纠结的是搭环境比较麻烦,稍有不慎,就会导致源代码编译不过,前功尽弃.为了减少工作量,以及避免不必要掉 ...

  6. spring mvc + velocity 搭建实例程序maven版本并且使用的是tomcat容器而不是jetty(step by step)

    笔者最近在学习spring mvc 查了很多资料,但用jsp的居多,但项目中需要用velocity,所以说就学习了一下,现将所查资料以及搭建过程陈述如下,供需要的人参考 1.楼主用的是eclipse+ ...

  7. java编程中Properties类的具体作用和使用!

    如果不熟悉 java.util.Properties类,那么现在告诉您它是用来在一个文件中存储键-值对的,其中键和值是用等号分隔的.(如清单 1 所示).最近更新的java.util.Properti ...

  8. ORA-20002: [WF_NO_USER] NAME=<name> ORIG_SYSTEM=NULL ORIG_SYSTEM_ID=NULL

    Solution APPLIES TO: Identity Manager Connector - Version 10.1.2 to 10.1.2Oracle User Management - V ...

  9. C#中的NameValueCollection简介

    NameValueCollection继承自NameObjectCollectionBase,并且和一般的键值对不同的是,它支持集合中出现相同的Key. 引用:using System.Collect ...

  10. Python 获取主机名

    import socket print socket.gethostname()