[HOW TO] change password Postgres

Hello Dude,

Today is the last of working day. I'm here with two monitor and one PC. Working as everyday.

Developer told me about postgre database. He could not connect to Postgres from PhpPgAdmin because don't know password's Postgres.

Ok, I like it. Yesterday, I just worked with Postgress installation.

Now, what's next step?

1. Check Postgres status as below:
~ # service postgresql status
9.1/main (port 5432): online

2. Check process running
# ps -ef | grep 'postgres'

root      4496  3831  0 08:44 pts/0    00:00:00 sudo su postgres
root      4497  4496  0 08:44 pts/0    00:00:00 su postgres
postgres  4506  4497  0 08:44 pts/0    00:00:00 bash
postgres  5252     1  0 08:54 ?        00:00:00 /usr/lib/postgresql/9.1/bin/postgres -D /var/lib/postgresql/9.1/main -c config_file=/etc/postgresql/9.1/main/postgresql.conf
postgres  5254  5252  0 08:54 ?        00:00:00 postgres: writer process                                                                                                  
postgres  5255  5252  0 08:54 ?        00:00:00 postgres: wal writer process                                                                                              
postgres  5256  5252  0 08:54 ?        00:00:00 postgres: autovacuum launcher process                                                                                      
postgres  5257  5252  0 08:54 ?        00:00:00 postgres: stats collector process                                                                                          
root     11805  4211  0 09:05 pts/2    00:00:00 grep --colour=auto postgres

3. 
# cd /var/lib/postgresql/9.1/main/

4. You must switch to postgres account.
# su postgres

5. Here, we start to change the password. You must remember it :)
postgres@~/9.1/main $ psql
psql (9.1.9)
Type "help" for help.

postgres=# alter user postgres with password '12345!fra';
ALTER ROLE
postgres=# 

We are done!

See you soon! I come back with some funny :)




Thank you for reading this article, please a comment if you are interested.
Tiến Phan - R0039
Knowledge is Endless
Sharing for Success

0 nhận xét:

Post a Comment