Reputation: 1879
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:
ALTER ROLE project WITH PASSWORD 'project'
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 -
Upvotes: 1
Views: 3114
Reputation: 61526
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).
Upvotes: 1
Reputation: 976
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
Upvotes: 0