【发布时间】:2016-10-15 03:04:51
【问题描述】:
我正在尝试在本地 Mongo 安装上激活用户授权,但身份验证不断失败。可能是什么问题?我错过了什么吗?
我按照“Installing on Windows”和“Enable Client Access Control”中列出的步骤进行操作:
1) 添加了一个用户
>mongo admin
MongoDB shell version: 3.2.7
connecting to: admin
> db.createUser({createUser:"admin",pwd:"admin",roles:["root"]})
Successfully added user: { "createUser" : "admin", "roles" : [ "root" ] }
>
2) 在mongod.cfg 中启用客户端访问控制:
systemLog:
destination: file
path: c:\data\log\mongod.log
storage:
dbPath: c:\data\db
security:
authorization: enabled
3) 重启mongod
4) 现在使用“正确”凭据(我刚刚指定的凭据)登录总是失败:
>mongo admin -u admin -p admin
MongoDB shell version: 3.2.7
connecting to: admin
2016-06-14T12:25:02.376+0200 E QUERY [thread1] Error: Authentication failed. :
DB.prototype._authOrThrow@src/mongo/shell/db.js:1441:20
@(auth):6:1
@(auth):1:2
exception: login failed
日志文件中的错误是:SCRAM-SHA-1 authentication failed for admin on admin from client 127.0.0.1 ; AuthenticationFailed: SCRAM-SHA-1 authentication failed, storedKey mismatch
平台是 Windows 10 x64,如果这很重要的话。 带有 OpenSSL 的 MongoDB 64 位 3.2.7。
【问题讨论】:
标签: mongodb