-
首先用root用戶登錄
-
執(zhí)行下面的命令切換到postgres用戶
su - postgres
-
備份數(shù)據(jù)庫
pg_dump -Fc yidu> yidu.dump
※默認(rèn)安裝的話,,文件會輸出到/var/lib/pgsql/yidu.dump
-
恢復(fù)數(shù)據(jù)庫
1.新建數(shù)據(jù)庫
createdb yidu
2.恢復(fù)數(shù)據(jù)庫
pg_restore -d yidu yidu.dump
刪除數(shù)據(jù)庫命令dropdb yidu