Re: pg_dump/pg_dumpall - Mailing list pgsql-novice

From Andrew C. Uselton
Subject Re: pg_dump/pg_dumpall
Date
Msg-id 46BCE0D0.10308@lbl.gov
Whole thread Raw
In response to Re: pg_dump/pg_dumpall  (Alan Hodgson <ahodgson@simkin.ca>)
Responses Re: pg_dump/pg_dumpall
List pgsql-novice
I am beginning to understand a little better.  Our database is
configured with the pg_hba.conf entry (the only entry):

local all all            md5 sameuser

The database cluster was created (initdb) in the default way, with no
-pwpromt.  Either a superuser password was never created or (less
likely) we just don't know what it is.  According to the administrative
reference if there is no superuser password you can't authenticate
against the "postgres" superuser at all.  This appears to be harmless
(i.e. not having a superuser password) for things like (as root):

su -l postgres -c "/usr/bin/createuser ..."

but also from the administrative reference I see that pg_dump and
pg_dumpall are going to require that I provide the appropriate password,
which will fail if the password was never set.  So it seems to me I need
to figure out how to set that password after the fact.  Is this possible?
-a


Alan Hodgson wrote:
> On Friday 10 August 2007 11:49, "Andrew C. Uselton" <acuselton@lbl.gov>
> wrote:
>
>> uselton]# pg_dumpall   > /tmp/osp5_pgsql.dump
>> Password:
>> pg_dumpall: could not connect to database "template1": FATAL:
>> Password authentication failed for user "root"
>>
>> If it really is asking for the 'root' password I am certainly giving
>> it correctly.  I am root as I issue the command as well.  I've tried
>> a few other guesses at what it might _really_ be wanting (including
>> using an explicit '-h host -p port'), but with no better luck.  Any
>> hints would be most appreciated. Cheers,
>>
>
> It is trying to connect as root, because you're logged in to your OS as
> root, but there probably isn't a root user in the database.
>
> You need to connect as a database superuser to do a backup. The normal
> default superuser is "postgres".  Where it gets its password from or
> even if it requires one depends on your configuration.
>
>

pgsql-novice by date:

Previous
From: "Jim Stalewski"
Date:
Subject: Re: Free designable front end for PostgreSQL
Next
From: Tom Lane
Date:
Subject: Re: analyzing query results