From: Scott Marlowe <smarlowe@g2switchworks.com>
To: Philippe Salama <karebacnyc@yahoo.com>
Cc: pgsql-admin@postgresql.org
Subject: Re: Lost password to user postgres
Date: Sat, 02 Dec 2006 17:25:23 -0600
Message-ID: <1165101923.25316.8.camel@localhost.localdomain> (raw)
In-Reply-To: <638600.66455.qm@web90513.mail.mud.yahoo.com>
References: <638600.66455.qm@web90513.mail.mud.yahoo.com>
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.
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: smarlowe@g2switchworks.com, karebacnyc@yahoo.com
Subject: Re: Lost password to user postgres
In-Reply-To: <1165101923.25316.8.camel@localhost.localdomain>
References: <638600.66455.qm@web90513.mail.mud.yahoo.com> <1165101923.25316.8.camel@localhost.localdomain>
* 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