### postgresql password reset ###
Step 1. Edit PostgreSQL config file to establish trust relationship to login without password:
# vi /var/lib/pgsql/data/pg_hba.conf
Old Line:
local all postgres password
Change it to:
local all postgres trust

Step 2. Restart PostgreSQL Server:
# /etc/rc.d/init.d/postgresql restart

Step 3. Change password:
# psql -U postgres template1 -c alter user postgres with password ‘newpassword’;

Step 4. Password has been updated. Revert back the original settings of config file:
# vi /var/lib/pgsql/data/pg_hba.conf
Old Line:
local all postgres trust
Change it to:
local all postgres password

Step 5. Restart server and use your new password to access PostgreSQL Server.
# /etc/rc.d/init.d/postgresql start


0X00. database conn #############
# psql -U segio template1

0x01. database list #########
=# \l
# psql -U postgres -l
        List of databases
   Name    |  Owner   | Encoding
-----------+----------+----------
 cell_000  | user_000 | UTF8
 postgres  | postgres | UTF8
 template0 | postgres | UTF8
 template1 | postgres | UTF8
(4 rows)

0x02.  database access#########
# psql -U postgres cell_000

0x03.  database table#########
cell_000=# \dt

0x04. user table #############
cell_000=# select * from user_info;
 no | rname  | uname  |   uid    |    passwd     |        email        |   mobile    |  birth   | zipcode | zipcode2 | addr1 | addr2 | addr3 | addr4 |           quiz           | answer | polimg | uimg |  level   |   wdate    | udate | open | type | class | ext1 | ext2 | ext3 | ext4 | ext5 | ext6
----+--------+--------+----------+---------------+---------------------+-------------+----------+---------+----------+-------+-------+-------+-------+--------------------------+--------+--------+------+----------+------------+-------+------+------+-------+------+------+------+------+------+------
  1 | sysop  | sysop  | sysop    | ㅇㅇㅇㅇ |                     |             |          |         |          |       |       |       |       |                          |        |        |      | 9,관리자 | 1294742453 |       |      | 0    |       |      |      |      |      |      |
(1건 있음)

Posted by 김주일