We all agree that hardcoding your password is a bad idea. This recipe shows us how to keep the password in a secure password file.
Not all database users need passwords; some databases use other means of authentication. Don't do this step unless you know you will be using password authentication, and you know your password.
First, remove the hardcoded password from where you'd set it previously. Completely remove the
password = xxxx text from the connection string in a program. Otherwise, when you test the password file, the hardcoded setting will override the details you are just about to place in the file. Having the password hardcoded and in the password file is not any better.