Posts tagged with “PostgresQL”

Postgres tip #2

Sunday, 5 August, 2007

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.

postgres tip #1

Tuesday, 22 November, 2005

I keep forgetting this… and it comes up every now and then. The new versions of postgres have pager set to less (at least in my gentoo install they do). Meaning when you quit less, the results vanish from the terminal — which is a pain if you wanted something to refer to.

The answer is to put:


export PAGER=more

in .bashrc