Skip to content

Instantly share code, notes, and snippets.

@syukronrm
Last active May 30, 2021 13:38
Show Gist options
  • Save syukronrm/00008adac2a6ec3b32616a1adc378f74 to your computer and use it in GitHub Desktop.
Save syukronrm/00008adac2a6ec3b32616a1adc378f74 to your computer and use it in GitHub Desktop.
Postgresql

Change to postgres user

sudo -i -u postgres

Backup

pg_dump -U [username] [db_name] > [backup_name]

Restore

psql [db_name] < [backup_file]

Login with explicit pass and hostname

psql -U youser -h 127.0.0.1 -W 
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment