2

I created a user john with createuser and didn't supply any passwords for it, i.e. no -P option specified. I then proceeded to add the following line above all other lines in the pg_hba.conf file:

host all john 127.0.0.1/32 trust

I then restarted the server but even after that, when I try to run psql -U john it keeps asking for a password. I even ran the command psql -c "alter role john with password null;" but it changed nothing. PostgreSQL keeps asking for a password for john. What am I missing?

Running PostgreSQL 13.2 on Windows 10.

asked May 1, 2021 at 19:19

1 Answer 1

4

By checking the logs, it got apparent that PostgreSQL was matching the ::1/128 IPv6 address, which had scram-sha-256 as its authentication method. adding a line like

host all john ::1/128 trust

fixed the problem.

Also, there is no need for restarting the DBMS after changes to pg_hba.conf.

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.