MongoDB 2.6.1命令行身份验证失败

 vfjgjgv 发布于 2023-01-14 15:30
  • php
  • 我设置了具有身份验证的副本集.我用过这个教程.我设置了密钥文件,管理员用户和其他用户.一切正常 - 匿名访问被禁用,我可以登录

    $ mongo
    MongoDB shell version: 2.6.1
    connecting to: test
    Error while trying to show server startup warnings: not authorized on admin to execute     command { getLog: "startupWarnings" }
    rs0:PRIMARY> use admin
    switched to db admin
    rs0:PRIMARY> db.auth("USERNAME","PASSWORD")
    1
    rs0:PRIMARY> 
    

    使用我创建的用户凭据.

    但我无法从命令行登录

    $ mongo -u 'USERNAME' -p 'PASSWORD'
    MongoDB shell version: 2.6.1
    connecting to: test
    2014-05-18T14:23:47.324+0200 Error: 18 { ok: 0.0, errmsg: "auth failed", code: 18 } at   src/mongo/shell/db.js:1210
    exception: login failed
    

    使用相同的凭据.我没有在文档中找到任何有用的信息,或者在SO上找到.

    撰写答案
    今天,你开发时遇到什么问题呢?
    立即提问
    热门标签
    PHP1.CN | 中国最专业的PHP中文社区 | PNG素材下载 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
    Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有