Mongodb – How to create a global MongoDB Admin account to see all Dbs

mongodbmongodb-3.0

I'm working on MongoDB, sysadmin helped setup the install.

I'm confused about MMS the Cloud Manager, I created an account for @admin database

enter image description here

I authenticate successfully but do not see "test" database
LinuxBox> ./mongo myipaddress:27000/admin -u DBASupport -p
** if I don't use /admin I default to "test" db

show dbs;
admin 0.078GB
local 0.078GB
show collections;
system.indexes
system.users
system.version

I am assuming I'm using a GLOBAL DB Admin account I created.. but it looks like it's for the "Admin" database.

Alternatively when I created another account "Test" as the database login "MyTestLogin" with Admin role… the Database I default connect to is "Test" database?

I thought since I'm connecting to same port 27000 with same MongoDB instance/service… I would see admin, local, and test databases??

I know i'm missing something here, but can some one explain

thanks

Best Answer

You created the user correctly, but you missed a parameter when connecting to mongod.

By default, the authentication process assumes that the user is stored in the database you connect to, which in your case simply isn't true.

You need to specify the autheticationDatabase option:

mongo yourMongodIpAddress:27000/targetDb \
--authenticationDatabase admin -u DBASupport -p yourPw