if you did call config:cache during local development, you can undo this by deleting the bootstrap/cache/config.php file. and this is work for me.
@Payal Pandav has given the comment above.
I want to tell a simple workaround. Just edit the config.php file in the bootstrap/cache/ folder. And change the credentials. This worked for me. Please don't delete this file since this may contain other crucial data in the production environment.