Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save jorandradefig/bd2d69dca9f03dc358ad0aed592ef1c4 to your computer and use it in GitHub Desktop.
Save jorandradefig/bd2d69dca9f03dc358ad0aed592ef1c4 to your computer and use it in GitHub Desktop.
PostgreSQL Dump & Restore

localhost

In Terminal:

Create dump

pg_dump -h 127.0.0.1 -p 5432 -U <user> -W -F t <database> | gzip > <gzipfile>.gz

Restore dump

gunzip -c <gzipfile>.gz | psql -h 127.0.0.1 -p 5432 -U <user> <database>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment