Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to change password for postgres? 1

Status
Not open for further replies.

totti24

Programmer
Aug 2, 2002
32
0
0
MY

can i know how to change the password for postgres? issit possible? coz i think the password when i first use it is null. thanks in advance.
 
Hi totti24,

The first step is to ensure no passwords are
required. You can do this by logging into
your system as root. Find your pg_hba.conf
file and set all previleges as trust. Then restart
postgres so the changes to pg_hba.conf take effect.
You may need to login or su to postgres to re-start
the database.

Now you should be able to access the template1
database as follows:

#>psql template1 postgres

Next, come out of postgres and login as root. Change the
linux password of the postgres user as follow:

#>passwd postgres

To change the postgresql postgres password, I alway
start pgaccess. You can start pgaccess from the linux desktop by opening a terminal window and typing:

#>pgaccess

Connect to the template1 database using pgaccess. Once
connect in throught pgaccess, select users. Select
postgres from the list of user that appear. Then select
design. A window will open that allows you to change
the postgresql password of the su postgres. Use the same
username/password pair that you used for the linux postgres
user.

Now you can edit the pg_hba.conf file again and change
the security to require passwords. If you get stuck, you
can login as root again and set security to trust to
setup everything again.

LelandJ

Leland F. Jackson, CPA
Software - Master (TM)
Nothing Runs Like the Fox
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top