3 回答

TA貢獻1773條經驗 獲得超3個贊
如果我沒記錯的話,默認情況下用戶postgres
沒有在Ubuntu上設置DB密碼。這意味著,您只能使用postgres
操作系統用戶帳戶登錄該帳戶。
假設您可以root
訪問該框,您可以執行以下操作:
sudo -u postgres psql
如果失敗并出現database "postgres" does not exists
錯誤,那么您很可能不在Ubuntu或Debian服務器上:-)在這種情況下,只需添加template1
命令:
sudo -u postgres psql template1
如果這些命令中的任何一個失敗并出現錯誤,psql: FATAL: password authentication failed for user "postgres"
則檢查文件/etc/postgresql/8.4/main/pg_hba.conf
:必須有這樣的行作為第一個非注釋行:
local all postgres ident
對于較新版本的PostgreSQL ident
實際上可能是peer
。那也沒關系。
在psql
shell中,您可以為DB用戶 postgres
提供密碼:
ALTER USER postgres PASSWORD 'newPassword';
您可以psql
通過鍵入CtrlD或使用命令離開shell \q
。
現在你應該能夠為pgAdmin提供DB超級用戶的有效密碼,它也會很開心。:-)

TA貢獻2003條經驗 獲得超2個贊
工作人員的反應是正確的,但如果你想進一步自動化可以做到:
$ sudo -u postgres psql -c "ALTER USER postgres PASSWORD 'postgres';"
完成!您保存了User = postgres和password = postgres。
如果您沒有用戶postgres ubuntu的密碼,請執行以下操作:
$ sudo passwd postgres
添加回答
舉報