2017年7月9日 星期日

重設PostgreSQL的密碼(Ubuntu OS)

1. 修改pg_hba.conf
    a) 可以使用locate找出檔案位置
locate pg_hba.conf
    b) 修改local all all這一行,改為trust
local  all   all   trust
2. 重啟PostgreSQL server
sudo /etc/init.d/postgresql restart
3. 進入postgres User
sudo su - postgres
4. 進入superuser postgres
psql -U postgres
5. 使用SQL的ALTER語句修改postgres的密碼
ALTER USER postgres PASSWORD '重設為你要的密碼';
6. 將pg_hba.conf修改回來

沒有留言:

張貼留言