Skip to content

Instantly share code, notes, and snippets.

@peketamin
Last active October 31, 2018 16:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save peketamin/b8c195097563971471f4e238284150f6 to your computer and use it in GitHub Desktop.
Save peketamin/b8c195097563971471f4e238284150f6 to your computer and use it in GitHub Desktop.
Connect postgres db with postgres user.
$ sudo -u postgres psql postgres
$ ssh -L 6432:localhost:5432 remote-server
$ pg_dump -Fc -U username -p 6432 -h localhost dbname > dbname.dump
$ pg_restore -h localhost -p 6432 -U username -d dbname dbname.dump
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment