We all agree that hardcoding your password is a bad idea. This recipe shows you how to keep your 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 had 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. Keeping the password hardcoded and in the password file is not any better. Using