I thought I’d already noted this somewhere, but a quick search failed to find the answer.
A new Postgres database installation always catches me out, when it comes to creating a user. I usually do the following:
1. update permissions in pg_hba.conf (to allow text password access, for example)
2. createuser -W <username>
(prompted for a password)
Then scratch my head when I try to create a database and get the following error:
createdb: could not connect to database postgres: FATAL: password authentication failed for user "<username>"
The answer is:
~$ sudo su - postgres
~$ psql
postgres=# alter user <username> with password '<password>';
ALTER ROLE
One of those annoying little details that is extremely easy to forget.


