Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have the following role in my system:


There is no password. Trying to connect to the db from within the same machine using either psql or PgAdmin3 to the above role I'm getting:

psql: fe_sendauth: no password supplied

When the password is set I can connect perfectly.

The pg_hba.conf is default - merely:

host    all             all               password
host    all             all             ::1/128                 password

Create Role statement help says:

PASSWORD password

Sets the role's password. (A password is only of use for roles having the LOGIN attribute, but you can nonetheless define one for roles without it.) If you do not plan to use password authentication you can omit this option. If no password is specified, the password will be set to null and password authentication will always fail for that user. A null password can optionally be written explicitly as PASSWORD NULL.

Can I deduct from that that having a NULL password password authentication will always fail? Is this also the case for MD5 authentication? Is there anyway to connect using an NULL password role without specifying trust authentication?

share|improve this question
up vote 2 down vote accepted

Indeed an empty password is equivalent to no password so it's not going to be accepted by the server when pg_hba.conf says that a password is required.

Still, there are various ways to avoid inputting the password:

  • trust method in pg_hba.conf, possibly constrained to a specific user and database
  • client-side PGPASSWORD environment variable
  • client-side .pgpass file
  • dummy password like "test" stored in the same place than the login name
share|improve this answer
Thanks! I don't mind to input password when there is one, I just look into a way of connecting when there is no password at all... – Vic Dec 31 '12 at 14:43
I believe adding trust entries for these users is the only way – Daniel Vérité Dec 31 '12 at 14:49
@Vic: Well, there are also the ident and peer authentication methods but those, too, are only for trusted clients ... – Erwin Brandstetter Dec 31 '12 at 21:10

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.