修改 postgres 的密碼 (二)
為了 postgres 的空白密碼,搞了兩天。
今天發現另一個改密碼的辦法。
1- 安裝 CentOS 5.2 後啟動 PostgreSQL。
  service postgresql start
  
  它們自動跑 initdb -D /var/lib/pgsql/data
  
2- 修改 pg_hba.conf
  vi /var/lib/pgsql/data/pg_hba.conf
  在 # IPv4 local connections: 加入一行
  host    all         all         192.168.0.1/24        trust
3- 然後用 pgAdmin III 連入 PostgreSQL,「儲存密碼」欄要選。
4- 在 pgAdmin 內更改密碼。
5- 重新修改 pg_hba.conf 如下:
  # TYPE  DATABASE    USER        CIDR-ADDRESS          METHOD
  # "local" is for Unix domain socket connections only
  local     all    all     ident     sameuser
  # IPv4 local connections:
  host         all              all              127.0.0.1/32               ident      sameuser
  host         all              all              192.168.0.1/24             password
  #host         all              all              192.168.0.1/24             trust
  # IPv6 local connections:
  host         all              all              ::1/128                    ident      sameuser
6- 重新啟動 PostgreSQL。
  service postgresql start
7- 再以 pgAdmin 登入時,要輸入密碼了。


 
 
沒有留言:
張貼留言