Mongo Atlas: Connection authentication failed with custom databases

后端 未结 4 2190
迷失自我
迷失自我 2021-02-19 21:37

I am trying the Mongo Atlas Cloud. I create a cluster and i am trying a connection with the mongo shell: (same problem with mongo drivers)

mongo mongodb://***-cl         


        
相关标签:
4条回答
  • 2021-02-19 21:41

    I also faced the same issue. "admin" user would be created at the time of db creation. If you forgot the password for the default admin user, then it is difficult to connect with the database and access the collections.

    You could create one more database user under "Security->Database Access" section and select "Atlas admin" as a role.

    If your password contains any special character, then this would be encrypted internally. Hence, use this link (https://www.urlencoder.org/) to encrypt your password (plain text) and use the encrypted string to establish a connection.

    0 讨论(0)
  • 2021-02-19 21:59

    Adding to Nath's answer, use "--authenticationDatabase admin" if your connecting via the mongo shell and use "authSource=admin" for drivers.

    Tested with [MongoDB shell version: 3.2.8]

    0 讨论(0)
  • 2021-02-19 22:03

    "authSource=admin" Is a requirement for All Atlas connections.

    0 讨论(0)
  • 2021-02-19 22:06

    You authenticate with the admin database. From there you can switch the database.

    When connecting using Mongo drivers, your connection string needs add the auth source:

    /any_database?authSource=admin&replicaSet=xyz
    
    0 讨论(0)
提交回复
热议问题