I used to have a user, say 'jack' in postgresql, and then I forgot what the password. I reassigned all its ownerships to user postgres, removed the user, and then created it again with CREATE USER jack;
.
Now if I try to connect with it, psql asks for a password.
$ psql db_name jack
Password for user jack:
psql: fe_sendauth: no password supplied
What is going on and how do I check if a user has a password or not?
Best Answer
A user having a password or not won't affect if you're asked for a password when trying to connect. That is controlled by the
pg_hba.conf
file.If you're being asked for a password that indicates that a password is required. If you try to connect to an account which doesn't have a password set that will simply fail. You need to either set a password for the account and use that, use a different type of connection or modify the
pg_hba.conf
file to use a different authentication method.