Gopinath Rajee
Gopinath Rajee

Reputation: 450

Connecting to MongoDB from mongo shell and Robo 3T

All,

I'm new to MongoDB and I was pulled into it when the vendor who setup our website left which means I'm learning everything from basic with a strong SQLServer DBA background.

On our Dev MongoDB V3.4.2 Windows installation, the vendor gave me a user named Monguser defined in admin with root as role and after they left I noticed Robo 3T as part of the installation.

When I try to connect via the mongo shell as below, I get an error with the message "Authentication failed". C:>mongo --username monguser --password mongold!234. I tried connecting to it via the Robo 3T and I'm able to connect via the same login/password.


Also, I was asked to create a backup of a database and I tried the following but it failed with the error Server returned error on SASL authentication step: Authentication failed for database MiningDB

C:\mongodump --username monguser --password mongold!234 --dbMiningDB

But if I run C:\mongodump --username monguser --password mongold!234 then it backs up all the databases in the installation without returning any error.

In both the cases, why am I getting the error? Any help will be deeply appreciated.

Thanks, rgn

Upvotes: 1

Views: 774

Answers (2)

Raveen Sanjay
Raveen Sanjay

Reputation: 1

C:\mongodump --username monguser --password mongold!234 in the above code you missed the authentication database.

In connection string we need to mention the database which we need to authenticate for login C:\mongodump --username monguser --password mongold!234 --db MiningDB

Upvotes: 0

Gopinath Rajee
Gopinath Rajee

Reputation: 450

OK. From the below link I figured out that I need to include "--authenticationDatabase admin"

Referred Link

Upvotes: 1

Related Questions