DEV Community

Cover image for How to fix the error 'MongoServerError: bad auth : Authentication failed'?

How to fix the error 'MongoServerError: bad auth : Authentication failed'?

Shafia Rahman Chowdhury on November 07, 2022

Oftentimes, you might come across the error "bad auth: authentication failed." What does this error mean? "Bad auth" means the authentication met...
Collapse
 
dapone profile image
Afisunlu Dapo

Great! the > had me for hours.

Collapse
 
masrafi404 profile image
Ali Hasan Masrafi

very helpful, thakn you!

Collapse
 
devnenyasha profile image
Melody Mbewe

Thanks buddy, you did a great job. I was stuck for hours. You really helped a lot.

Collapse
 
grim_reaper profile image
Samuel Akong

Thanks soo much this was very helpful am so glad i saw this post thanks bro

Collapse
 
majorroots profile image
DiscFlight

My issue was that my nodemon needed a hard restart after editing the env variables.

Collapse
 
mernsanowar profile image
Md Sanowar Hossain

very helpful

Collapse
 
niketketanbhaipatadiya profile image
Niket Patadiya

Great Thank you so much finding solutions from 2 hours by this i have solved error in 5 minutes..

Collapse
 
harbdoulryhahemn profile image
harbdoulryhahemn

Waow! this is great... thanks bro.

Collapse
 
strubloid profile image
Strubloid

Why you never had the things to copy and paste? if we are having some issues with the string, could be nice to have in your article what is right by copying it, so we could compare what is working for you with our own configuration.

Collapse
 
emeka_f3888 profile image
Emeka Okorie Ezeogo

Hey Guys, if you are having this same challenge especially with any mac OS.

Ensure to remove anything user on your DB_Username key and replace it with only Name.
Everything regarding this challenge will be resolved.

Collapse
 
sam_natangwe_4f0977b5ba72 profile image
Sam Natangwe

I have removed the user and password it worked fine mongodb Shell image running on Podman container.