新版本已取消addUser方法,改使用createUser方法

官方地址:https://docs.mongodb.com/manual/tutorial/create-users/

官方地址:https://docs.mongodb.com/manual/reference/command/createUser/#dbcmd.createUser

role权限:https://docs.mongodb.com/manual/reference/built-in-roles/#built-in-roles

db.createUser(
{
user:'user',
pwd:'passwd',
roles:["dbAdminAnyDatabase","readWriteAnyDatabase"]
}
)

新版本默认使用SCRAM-SHA-1认证方式,连接mongo时会遇到这种报错:

错误:Failed to authenticate *@* with mechanism MONGODB-CR: AuthenticationFailed: MONGODB-CR credentials missing in the user document

> use admin   
switched to db admin
> var schema = db.system.version.findOne({"_id" : "authSchema"}) >schema.currentVersion = 3
3
> db.system.version.save(schema)
WriteResult({ "nMatched" : 1, "nUpserted" : 0, "nModified" : 1 })

无法登录的用户需要删除重新添加

【MongoDB】MongoDB 3.2 SCRAM-SHA-1验证方式的更多相关文章

  1. 单点登录(十四)-----实战-----cas5.0.x登录mongodb验证方式常规的四种加密的思考和分析

    我们在上一篇文章中已经讲解了cas4.2.X登录启用mongodb验证方式 单点登录(十三)-----实战-----cas4.2.X登录启用mongodb验证方式完整流程 但是密码是明文存储的,也就是 ...

  2. 单点登录(十七)----cas4.2.x登录mongodb验证方式成功后返回更多信息更多属性到客户端

    我们在之前已经完成了cas4.2.x登录使用mongodb验证方式登录成功了.也解决了登录名中使用中文乱码的问题. 单点登录(十三)-----实战-----cas4.2.X登录启用mongodb验证方 ...

  3. 单点登录(十五)-----实战-----cas4.2.x登录mongodb验证方式实现自定义加密

    我们在前一篇文章中实现了cas4.2.x登录使用mongodb验证方式. 单点登录(十三)-----实战-----cas4.2.X登录启用mongodb验证方式完整流程 也学习参考了cas5.0.x版 ...

  4. 单点登录(十三)-----实战-----cas4.2.X登录启用mongodb验证方式完整流程

    我们在之前的文章中中已经讲到了正确部署运行cas server 和 在cas client中配置. 在此基础上 我们去掉了https的验证,启用了http访问的模式. 单点登录(七)-----实战-- ...

  5. 单点登录(十二)-----遇到问题-----cas启用mongodb验证方式登录后没反应-pac4j-mongo包中的MongoAuthenticatInvocationTargetException

    cas启用mongodb验证方式登录后没反应 控制台输出 2017-02-09 20:27:15,766 INFO [org.jasig.cas.authentication.MongoAuthent ...

  6. 单点登录(十一)-----遇到问题-----cas启用mongodb验证方式报错--Unable to locate Spring NamespaceHandler for XML schema na

    cas启用mongodb验证方式报错--Unable to locate Spring NamespaceHandler for XML schema namespace [http://www.sp ...

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

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

  8. [MongoDB]MongoDB与JAVA结合使用CRUD

    汇总: 1. [MongoDB]安装MongoDB2. [MongoDB]Mongo基本使用:3. [MongoDB]MongoDB的优缺点及与关系型数据库的比较4. [MongoDB]MongoDB ...

  9. [MongoDB]MongoDB的优缺点及与关系型数据库的比较

    汇总: 1. [MongoDB]安装MongoDB2. [MongoDB]Mongo基本使用:3. [MongoDB]MongoDB的优缺点及与关系型数据库的比较4. [MongoDB]MongoDB ...

  10. Getting Started with MongoDB (MongoDB Shell Edition)

    https://docs.mongodb.com/getting-started/shell/ Overview Welcome to the Getting Started with MongoDB ...

随机推荐

  1. 安卓开发学习经历2--《第一行代码》coolweather项目SQL语句同一个“陷阱”掉两次 注意转义字符等特殊字符正确书写 关于Id字段自增加体会

    今天,在运行<第一行代码>coolweather第二阶段代码,又一次报错,还是神奇地与昨天相似,提示,city_id字段不存在,这里我有两种理解,一种是sql语句出错了,另外一种是没有获取 ...

  2. php获取文件名称和扩展名

    1.basename()-返回路径的文件名请看下面php代码: <?php $path = "/usr/www/html/index.php"; echo basename( ...

  3. JavaScript分离代码理解

    window.onload=prepareLinks; //页面加载触发onload事件 function prepareLinks(){ //定义函数 var links=document.getE ...

  4. Enterprise Library 6

    Enterprise Library 6 正式版 MSDN:http://msdn.microsoft.com/en-gb/library/dn169621.aspx 源码下载:http://entl ...

  5. Python爬虫库Scrapy入门1--爬取当当网商品数据

    1.关于scrapy库的介绍,可以查看其官方文档:http://scrapy-chs.readthedocs.io/zh_CN/latest/ 2.安装:pip install scrapy  注意这 ...

  6. [PHP] - Laravel - Route路由

    前言 这里使用的是Laravel 5 PHP Laravel的路由比较强悍,但也正因如此,不统一而容易凌乱.比如在路由中可以直接写方法操作(破坏封装啊) 以下是个人学习的例子,不供参考 路由中的直接方 ...

  7. LeetCode "Design Twitter"

    A mix of hashmap, list and heap. struct Tw { Tw(long long pts, int tid) { ts = pts; tweetid = tid; } ...

  8. Docker Registry服务启动过程浅析

    当我们pull一个registry镜像或者自己制作一个镜像之后,使用命令docker run -d -p 5000:5000 registry,就可以启动一个私有容器服务,那么究竟是怎么做到的呢? 首 ...

  9. tinyPng Photoshop Plugin 安装的坑

    一定要注意两点: 第一: 注册表注册路径要修改为自己安装ps cc时的注册表路径[HKEY_LOCAL_MACHINE\SOFTWARE\Adobe\Photoshop\70.0]第二: Applic ...

  10. Unity UI on the HoloLens

    Following the steps under "Required configuration" will allow Unity UI to continue to work ...