The utf9k logo which is a cartoon robot utf9k


How can I export a database?

Using pg_dump, which ships with the psql executable, it’s a pretty simple progress

pg_dump --dbname={{DBNAME}} --host={{HOST}} --port={{PORT}} --username={{USERNAME}} --password --format=c > {{NAME}}.dump
# The c in --format=c stands for custom

How can I import a dumped database?

Using pg_restore, it’s almost the same process as pg_dump but in reverse

pg_restore --dbname={{DBNAME}} --host={{HOST}} --port={{PORT}} --username={{USERNAME}} --password --jobs 2 {{NAME}}.dump