PostgreSQL and some related databases can store connection passwords in a file, commonly referred to as a .pgpass file. 

To use a password file:

  1. In your home folder*, create the password file .pgpass
    Example: C:\users\yourusername\.pgpass
  2. Edit the file to hold your passwords as described in the PostgreSQL documention for The Password File
  3. Update your connection to use .pgpass as the authentication source (see Create a New Database Connection):

*The home folder varies with the operating system:

C:\Users\<user> (also %USERPROFILE%)
/home/<user> or /usr/home/<user> (also $HOME or ~)
macOS/Users/<user> (also $HOME or ~)