我使用認證設置了副本集。我用this教程。我設置了密鑰文件,管理用戶和其他用戶。它一切正常 - 匿名訪問被禁用,我可以登錄MongoDB 2.6.1命令行認證失敗
$ 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
使用相同的憑據登錄。我沒有在文檔中或在這裏找到任何有用的幫助。
是啊,我也不會明白這一點......感謝名單,它工作:-) –
這個問題,因爲它不是在蒙戈文檔正確指定的回答值得許多upvotes。 –
**在Mongo文檔中沒有指定任何**。 – Obscaenvs