3 回答

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

TA貢獻(xiàn)2003條經(jīng)驗(yàn) 獲得超2個(gè)贊
工作人員的反應(yīng)是正確的,但如果你想進(jìn)一步自動(dòng)化可以做到:
$ sudo -u postgres psql -c "ALTER USER postgres PASSWORD 'postgres';"
完成!您保存了User = postgres和password = postgres。
如果您沒(méi)有用戶(hù)postgres ubuntu的密碼,請(qǐng)執(zhí)行以下操作:
$ sudo passwd postgres
添加回答
舉報(bào)