I just upgraded my MongoDB instance from 2.4.x to the latest 2.6. And I configured Mongo to enable the authentication by updating this property:
auth = true
Then, I created users in each collection with specific roles. And it's working well.
But I have RockMongo connected to this instance, and I have this error:
Failed to connect to: XXX:YYY: Authentication failed on database 'local' with username 'ZZZZ': auth failed
I tried to connect to the 'local' database, and to create a new user like that:
use local
db.createUser(
{
user: "XXX",
pwd: "YYY",
roles: [ { role: "readWrite", db: "local" }, { role: "userAdminAnyDatabase", db: "local" } ]
}
)
But, I get an error:
2015-02-20T15:49:55.892+0000 Error: couldn't add user: Cannot create users in the local database at src/mongo/shell/db.js:1004
Any idea, why ?
Thanks for your help.
you cannot create users in the local database http://docs.mongodb.org/manual/reference/method/db.createUser/#local-database
Instead, you can create your user in the admin database who can readWrite in the local db:
use admin
db.createUser(
{
user: "XXX",
pwd: "YYY",
roles: [ { role: "readWrite", db: "local" } ]
}
)
When logging in as user XXX, be sure to specify the --authenticationDatabase admin
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With