Sample Header Ad - 728x90

PostgreSQL: Using the .pgpass file

7 votes
2 answers
14037 views
I have been reading up on the .pgpass file, but I can’t get it working for me. My .pgpass file looks something like this: 127.0.0.1:5432:accounts:fred:p@55w0rd I set the privilege to 0600 (this is on CentOS Linux) and try:
psql
Where I get the message: >psql: error: FATAL: database "…" does not exist where is my user name. I can successfully connect if I use:
psql -u … -d accounts
so I don’t think my .pgpass file is doing its job. How can I get it to work?
Asked by Manngo (3145 rep)
Aug 8, 2021, 07:25 AM
Last activity: Mar 8, 2025, 07:40 PM