On the Atlas home page, go to Network access settings, then add your IP address. If it is already there and not working, then change it to 0.0.0.0/0
It will allow you to connect to the database from anywhere. Now go to Database Access and change your password.
I tried many steps, but in the end, the above-given steps worked.