Question
I set up an AWS RDS PostgreSQL 10.4 database. The dataset is in a private network, therefore, I use a bastion to forward the connection to it. I can then connect using Postico but not using psql.
Details
I installed PostgreSQL locally using brew install postgres
. The command output is (and on a AWS instance see update):
❯ psql --version
psql (PostgreSQL) 10.5
Then I use the following SSH command to tunnel:
ssh -q -o "ConnectTimeout 3" -o "StrictHostKeyChecking no" -o "UserKnownHostsFile /dev/null" -i bastion-key.pem -L 5432:xxxxxx.xxxxx.eu-central-1.rds.amazonaws.com:5432 ec2-user@xx.xx.xx.xx -N
Then I connect using Postico .. everything fine!
Last but not least I try to connect using the following command:
❯ psql \
--host=127.0.0.1 \
--port=5432 \
--username=USERNAME \
--password \
--dbname=DBNAME
Password for user USERNAME:
psql: FATAL: password authentication failed for user "USERNAME"
FATAL: password authentication failed for user "USERNAME"
I use a macOS High Sierra Version 10.13.6 Macbook 13".
Update 2018-12-05:
Tried it also from a Amazon image running Amazon Linux release 2 (Karoo)
same result with psql 9 as version 10. Version 10 was installed following this recommendation.