mongodb 非 admin 库 认证登陆失败 原因(百度好多都 是渣)db.addUser() 请走开。
首先先晒一下log 日志错误信息
2016-07-13T22:19:43.667+0800 I ACCESS [conn4] authenticate db: finddemo { aut
henticate: 1, nonce: "xxx", user: "user1", key: "xxx" }
2016-07-13T22:19:43.668+0800 I ACCESS [conn4] Failed to authenticate user1@fin
ddemo with mechanism MONGODB-CR: AuthenticationFailed: UserNotFound: Could not f
ind user user1@finddemo
2016-07-13T22:20:12.555+0800 I ACCESS [conn2] SCRAM-SHA-1 authentication faile
d for user1 on finddemo from client 127.0.0.1 ; UserNotFound: Could not find use
r user1@finddemo
2016-07-13T22:20:17.127+0800 I NETWORK [initandlisten] connection accepted from
127.0.0.1:56103 #5 (4 connections now open)
2016-07-13T22:20:17.127+0800 I ACCESS [conn5] authenticate db: admin { authen
ticate: 1, nonce: "xxx", user: "root", key: "xxx" }
2016-07-13T22:20:17.146+0800 I NETWORK [initandlisten] connection accepted from
127.0.0.1:56104 #6 (5 connections now open)
2016-07-13T22:20:17.146+0800 I ACCESS [conn6] authenticate db: admin { authen
ticate: 1, nonce: "xxx", user: "root", key: "xxx" }
着重看一下 这个报错信息,
SCRAM-SHA-1 authentication failed for user1 on finddemo
这是什么鸟?
mongodb加入了SCRAM-SHA-1校验方式,需要第三方工具配合进行验证,下面给出具体解决办法:
首先关闭认证,修改system.version文档里面的authSchema版本为3,初始安装时候应该是5,命令行如下:
> use admin
switched to db admin
> var schema = db.system.version.findOne({"_id" : "authSchema"})
> schema.currentVersion = > db.system.version.save(schema)
WriteResult({ "nMatched" : , "nUpserted" : , "nModified" : })
下面是获取到的用户的相关信息
{ "_id" : "admin.root", "user" : "root", "db" : "admin", "credentials" : { "MONGODB-CR" : "97a156792bd180dc82cec9a56d838991" }, "roles" : [ { "role" : "__system", "db" : "admin" } ] }
{ "_id" : "finddemo.finddemo", "user" : "finddemo", "db" : "finddemo", "credentials" : { "MONGODB-CR" : "4b8dce39de95d553473c1998f43aa165" }, "roles" : [ { "role" : "dbOwner", "db" : "finddemo" } ] }
重新连接,成功。
可以查看一下链接介绍:
https://docs.mongodb.com/master/release-notes/3.0-scram/
还有国外友人的回答:(越来越鄙视百度党)
http://stackoverflow.com/questions/29006887/mongodb-cr-authentication-failed
mongodb 非 admin 库 认证登陆失败 原因(百度好多都 是渣)db.addUser() 请走开。的更多相关文章
- 数据库登陆失败原因: 未与信任 SQL Server 连接相关联
解决方案:用户 'sa' 登录失败.原因: 未与信任 SQL Server 连接相关联. 问题简述: 用户 'sa' 登录失败.原因: 未与信任 SQL Server 连接相关联. 说明: 执行当前 ...
- mongodb3.0副本集搭建补充~~非admin数据库的用户权限
之前有搭建mongodb3.0的副本集,不过当时直接使用的admin数据库,用户也是直接给的root. 链接:http://blog.csdn.net/tuzongxun/article/detail ...
- mysql主库用户密码登陆失败从库正常
问题描述:有业务反馈称数据库上的用户有的可以登陆,有的不能登录,是不是集群有问题.怎么会有这么奇怪的问题,是不是最大连接数达到限制了. 环境:keepalived+mysql 5.7.37主从 登录数 ...
- MongoDB安全及身份认证
前面的话 本文将详细介绍MongoDB安全相关的内容 概述 MongoDB安全主要包括以下4个方面 1.物理隔离 系统不论设计的多么完善,在实施过程中,总会存在一些漏洞.如果能够把不安全的使用方与Mo ...
- mongodb管理与安全认证
mongodb数据管理 数据的导出.数据导入数据导出 mongoexport [使用mongoexport -h查看参数] 数据导入 mongoimport [使用mongoimport -h查看参数 ...
- 【Mongodb】用户和认证 权限总结
开启MongoDB服务时不添加任何参数时,默认是没有权限验证的,登录的用户可以对数据库任意操作而且可以远程访问数据库! 在刚安装完毕的时候MongoDB都默认有一个admin数据库,此时admin ...
- MongoDB复制集安全认证
之前我有一篇博客写的是“node.js通过权限验证连接MongoDB”,这篇博客上提到如何在启动文件中通过配置auth参数来开启权限认证,但这种认证方式只适合单机节点,当我们使用复制集时应该怎么开启权 ...
- MongoDB 副本集+分片 认证方式搭建
MongoDB 副本集+分片 认证方式搭建 参考资料: https://www.cnblogs.com/ityouknow/p/7344005.htmlhttps://jorwen-fang.itey ...
- 如何在linux中部署mongodb并设置连接认证
在windows上给mongodb设置连接认证权限:mongodb默认是不认证的,默认没有账号,现在就讲讲怎么设置账户和密码 1.首先进入C:\mongodb\bin下面双击运行mongo.exe启动 ...
随机推荐
- zabbix邮件报警脚本
#!/usr/bin/python #coding:utf-8 import smtplib from email.mime.text import MIMEText import sys mail_ ...
- oracl使用DataBase Configuration Assistant创建、删除数据库
原文:oracl使用DataBase Configuration Assistant创建.删除数据库 可以使用DataBase Configuration Assistant来创建一个心得数据库.Da ...
- android 98 MediaPlayer+SurfaceView播放视频
package com.itheima.videoplayer; import java.io.IOException; import android.media.MediaPlayer; impor ...
- iotop,pt-ioprofile : mysql IO负载高的来源定位
http://www.cnblogs.com/cenalulu/archive/2013/04/12/3016714.html 前言: 在一般运维工作中经常会遇到这么一个场景,服务器的IO负载很高(i ...
- The 10 Most Important Security Controls Missing in JavaEE--reference
JavaEE has some excellent built-in security mechanisms, but they don’t come close to covering all th ...
- MySQL【第一篇】安装
一.简介 MySQL 是最流行的关系型数据库管理系统,由瑞典MySQL AB公司开发,目前属于Oracle公司.MySQL所使用的SQL语言是用于访问数据库的最常用标准化语言.MySQL由于其体积小. ...
- Java基础知识强化之IO流笔记57:数据输入输出流(操作基本数据类型)
1. 数据输入输出流(操作基本数据类型) (1)数据输入流:DataInputStream DataInputStream(InputStream in) (2)数据输出流:DataOutputStr ...
- javascript笔记09:javascript的下拉式导航菜单
<!DOCTYPE html> <html> <body> <script> function hideAll() { for(i=0;i<odi ...
- 使用Netty进行Android与Server端通信实现文字发送接收与图片上传
ANOTHER TITLE: Let’s use netty to achieve text send and receive and image transfer to server based ...
- linux下安装apache2.4
linux安装Apache2步骤如下 apr 下载地址 http://mirrors.cnnic.cn/apache//apr/apr-1.5.2.tar.gz 安装过程 tar -xzvf apr- ...