Some possible reasons and solutions
Wrong host
Use the “-h” flag:
psql -h localhost -U phisaver --password
Wrong syntax
Use -U and -W flags for user and password
psql -U fred -W
> prompts for password
Not allowed
Check your conf file/s. Google dat.
Ensure TCP access is allowed for remote access, as local Unix socket access is the default.
Admin account
I get password failure with:
psql -h localhost -U phisaver --password
And instead need to switch to the user in shell to execute psql
sudo -u postgres psql
psql>