Skip to content

Instantly share code, notes, and snippets.

@adamghill
Created December 3, 2022 21:15
Show Gist options
  • Save adamghill/800008aa4d6410931858c695464e83f4 to your computer and use it in GitHub Desktop.
Save adamghill/800008aa4d6410931858c695464e83f4 to your computer and use it in GitHub Desktop.
Backup and restore postgres database
PGPASSWORD=PASSWORD pg_dump -h HOST_URL -p PORT -U USER --format=custom --no-acl --no-owner DATABASE_NAME > sql.dump
PGPASSWORD=PASSWORD pg_restore --verbose --clean --no-acl --no-owner -h HOST_URL -p PORT -U USER -d DATABASE_NAME sql.dump
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment