Skip to content

Instantly share code, notes, and snippets.

@davidfuhr
Last active September 12, 2017 07:52
Show Gist options
  • Save davidfuhr/e008aa1ec71450a2877d23266dd4227e to your computer and use it in GitHub Desktop.
Save davidfuhr/e008aa1ec71450a2877d23266dd4227e to your computer and use it in GitHub Desktop.
copy remote postgres db to localhost
echo 'localhost:5432:my_database:my_user:my_password' >> ~/.pgpass
chmod 0600 ~/.pgpass
ssh -C db.example.com 'echo my_password|pg_dump -h localhost -n my_schema -U my_remote_user -c my_remote_db' | psql -h localhost -U my_user my_database
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment