$ pg_dumpall -U postgres > all.sql
$ pg_dump -d mydb -f mydb_backup.sql
a Dump only the data, not the schemas Dump only the schema, no datac Drop database before recreatingC Create database before restoringt Dump the named table(s) onlyF Format (c: custom, d: directory, t: tar)Use pg_dump -? to get the full list of options
$ psql -U user mydb < mydb_backup.sql
$ pg_restore -d mydb mydb_backup.sql -c
U Specify a database userc Drop database before recreatingC Create database before restoringe Exit if an error has encountered