.pgpass is a common way to store connection information in PostgreSQL instead of typing password every time your login to your database using psql.
On Windows, the file is named
You can create a
.pgpass file in your home folder and input your login credentials with the following structure:
Except for the password, each field can be replaced with an asterisk (
*) value to match anything.
It means you can use the username
myadmin and password
[email protected] to login to the database
postgres on every host and port.
After you finish, remember to set the proper permission so it would be used by psql:
sudo chmod 600 .pgpass
PGPASSFILE file to set environment variable:
Need a good GUI tool for databases? TablePlus provides a native client that allows you to access and manage Oracle, MySQL, SQL Server, PostgreSQL and many other databases simultaneously using an intuitive and powerful graphical interface.
Not on Mac? Download TablePlus for Windows.
On Linux? Download TablePlus for Linux
Need a quick edit on the go? Download TablePlus for iOS