From: Andy Shellam (Mailing Lists) <andy.shellam-lists@mailnetwork.co.uk>
To: Scott Marlowe <smarlowe@g2switchworks.com>
Cc: Philippe Salama <karebacnyc@yahoo.com>
Cc: pgsql-admin@postgresql.org
Subject: Re: Lost password to user postgres
Date: Sun, 03 Dec 2006 11:29:46 +0000
Message-ID: <4572B52A.40600@mailnetwork.co.uk> (raw)
In-Reply-To: <1165101923.25316.8.camel@localhost.localdomain>
References: <638600.66455.qm@web90513.mail.mud.yahoo.com>
<1165101923.25316.8.camel@localhost.localdomain>
Regarding point 1, Scott, the user is on Windows.
Windows binaries are available at www.postgresql.org and a lot has
changed in the last 2 years, so if you do go down the re-install route,
I'd recommend upgrading, although you'll have to dump your old data out
of the server first, then restore it in to the new version.
Regarding passwords, are you talking about the service account for the
PostgreSQL database, or the postgres user in the database server?
You can change the service account using the "Local Users & Groups"
control panel (run "lusrmgr.msc") but you'll also need to change the
logon user in the Services control panel for the PostgreSQL Database
Server service.
If you're talking about the postgres user, edit your pg_hba.conf file
(Start > Programs > PostgreSQL [version] > Edit pg_hba.conf (or
there-abouts.)
Add (or change if it already exists) a line (if it doesn't exist, add it
before any other "host...." lines)
host all all 127.0.0.1/32 trust
And restart the PostgreSQL service.
Then when you connect to 'localhost', you'll always be granted access.
Login, change the postgres user password, then edit your pg_hba.conf
file again, to:
host all all 127.0.0.1/32 md5
And restart the service, then you should be able to login with that
password.
Andy.
Scott Marlowe wrote:
> On Sat, 2006-12-02 at 11:44 -0800, Philippe Salama wrote:
>
>> 2 years ago, I installed postgresql on my desktop and used it for a
>> while for learning purposes. Then, I stopped using it. I forgot the
>> password to the user postgres
>>
>
> You don't have to reinstall. you've got three basic options:
>
> 1. Change the password in single user mode
> 2. Edit pg_hba.conf and set it to trust mode, change your password,
> change back to md5
> 3. Re-initdb your cluster.
>
> For 1:
> su - postgres (from root if you have to)
> pg_ctl stop
> postgres template1 (or some other database you know exists)
> alter user postgres password 'newpassword';
>
> For 2:
> su - postgres
> cd $PGDATA
> vi pg_hba.conf
> // change entries at bottom to trust
> pg_ctl reload
> psql template1
> alter user postgres password 'newpassword';
>
> For 3:
> su - postgres
> pg_ctl stop
> echo $PGDATA // make sure this is set to something like /var/lib/pgsql
> rm -rf $PGDATA/*
> initdb // with whatever options you need.
>
> I prefer option 2, as you don't have to take down your database to do
> it.
>
> ---------------------------(end of broadcast)---------------------------
> TIP 4: Have you searched our list archives?
>
> http://archives.postgresql.org
>
> !DSPAM:37,45720b9840411059761709!
>
>
>
--
Andy Shellam
NetServe Support Team
the Mail Network
"an alternative in a standardised world"
p: +44 (0) 121 288 0832/0839
m: +44 (0) 7818 000834
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-admin@postgresql.org
Cc: andy.shellam-lists@mailnetwork.co.uk, smarlowe@g2switchworks.com, karebacnyc@yahoo.com
Subject: Re: Lost password to user postgres
In-Reply-To: <4572B52A.40600@mailnetwork.co.uk>
References: <638600.66455.qm@web90513.mail.mud.yahoo.com> <1165101923.25316.8.camel@localhost.localdomain> <4572B52A.40600@mailnetwork.co.uk>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox