Restore a database with psql

$ psql -U user mydb < mydb\_backup.sql

Restore a database with pg_restore

$ pg\_restore -d mydb mydb\_backup.sql -c
  •   -U   Specify a database user
  •   -c   Drop database before recreating
  •   -C   Create database before restoring
  •   -e   Exit if an error has encountered
  •   -F   Format (c: custom, d: directory, t: tar, p: plain text sql(default)) Use pg_restore -? to get the full list of options
Comments