Error Message: MongoError: bad auth Authentication failed through URI string

前端 未结 15 1732
终归单人心
终归单人心 2020-12-29 02:36

I\'m trying to connect to my mongoDB server via the connection string given to me by mongo:

"mongodb+srv://david:p         


        
相关标签:
15条回答
  • 2020-12-29 02:40

    The same problem i faced with mongoDB password authentication failed.

    "Error: bad auth Authentication failed."

    As per Pawan's suggestion given above i replaced my login password in MONGO_URI link with database password and it works. be sure to check that one also.

    If you not generated the generate new one or if created earlier then replace with new one.

    0 讨论(0)
  • 2020-12-29 02:41

    In my case, my password was wrong, to diagnostic the error, I have been follow the next steps:

    I have to try connection by command line:

    Whit this command: mongo "mongodb+srv://cluster0-j8ods.mongodb.net/test" --username :

    The response was again: 2020-04-26T11:48:27.641-0500 E QUERY [js] Error: bad auth Authentication failed. :

    then I'm change the password for my user, in my case, root user. and thats it, I'm authorized

    0 讨论(0)
  • 2020-12-29 02:45

    Checklist to follow:

    1) Make sure you're using the correct password (the DB user password and not the Mongo account).

    2) When entering your password, make sure all special characters are URL encoded (for example: p@ssword should be p%40ssword).

    3) If you don't remember your password of your DB user - go to Database Access (if you're using Mongo Atlas) -> select your DB user -> edit -> create a new password -> don't forget update to click on 'Update User'.

    (!) Security warning: Do not write the password in plain text inside your code - Follow the suggestions given here.

    0 讨论(0)
  • 2020-12-29 02:49

    This Happens because entered password is wrong.Because you are entering login password not cluster one.

    Solution ===> step 1. click Database Access From left Side Navigation of mongodb atlas page.

    step 2. select your username and and click to edit from right side.

    step 3. click to change password.

    step 4. click update user.

    During change password keep password only alphabetical because special characters need encoding.

    that's all now you can connect.

    Happy Coding.

    0 讨论(0)
  • 2020-12-29 02:50

    You can also get rid of this error by creating a new database user by going to Database Access from the left side and then go to Add New Database User from right right. Now create a new username and password, click OK. Now replace this new username and password into the MongoUri.

    0 讨论(0)
  • 2020-12-29 02:58

    Check your Password and Database Name is if it's correct

    0 讨论(0)
提交回复
热议问题