Reputation: 120
I have a some problem with MongoDB (2.6.12). I have one database with collections and a lot of data. Then I created user with readWrite
role, enabled auth=true
in mongod.conf
, restarted 'mongod' service.
Looks like auth works fine, but I can't see any data/collections in DB. I can't use 'find' query, in mongo shell it just returns nothing (empty line). I also can connect to DB without credentials and I see the same result.
I've tried a different roles and different users, but I can't get access to my data. What can be a problem?
Upvotes: 0
Views: 1599
Reputation: 1580
OK!
mongo host:port -u user -p password --authenticationDatabase admin
mongo host:port -u user -p password --authenticationDatabase admin myOwnDB
OR
use myOwnDB
IF you don't know your database name. When you have login successful, give command 'show dbs' to list all databases.
show dbs
After that you can use command 'use db_name' to change database. Then you can use command 'show collections' to list all collections on that database.
use myOwnDB
show collections
Upvotes: 1