1

I'm stuck.

The task: I need to have a certain Postgres user to own certain database with predefined password. Basically, I just don't want to maintain separate development settings for Django project apart from those present in our project's repo.

Prerequisites: PostgreSQL 9.1 on Ubuntu, database 'project' which has the owner 'project'. The 'project' user is seems to be also superuser, and should have the password 'project'. Of course there are fake names, just because of NDA. Note: I'm able to log in as 'postgres' user, that's how I use the database right now.

The problem: I tried a set of ways, mostly obvious which can be found here on Stackoverflow or in Google, to set a password to this user, but still having 'password authentication failed' message (see below).

What I've tried:

  • setting up password via PgAdmin
  • setting up password through ALTER ROLE project WITH PASSWORD 'project'
  • changing settings in pg_hba.conf, tried local all project peer, local all project md5

Maybe I'm missing something straightforward, please let me know.

Thanks!

UPDATE:

Here is a screenshot for this user from login roles pane - Login roles pane

Community
  • 1
  • 1
Serge Tarkovski
  • 1,771
  • 6
  • 17
  • 24

2 Answers2

1

See that part at the bottom of your screenshot:

.. VALID UNTIL '1970-01-01 00:00:00:

or the "Account Expires" field above

That expiration date is wrong and explains why this account can't login.

Presumably you've been bitten by the pgAdmin bug mentioned here:

Postgres password authentication fails

TL;DR solution: ALTER USER username VALID UNTIL 'infinity';

(and of course update pgAdmin).

Community
  • 1
  • 1
Daniel Vérité
  • 53,594
  • 14
  • 124
  • 144
0

Is the LOGIN attribute set in your role? CREATE ROLE does not set this attribute by default. See: http://www.postgresql.org/docs/9.1/static/role-attributes.html

Anton
  • 886
  • 1
  • 8
  • 27