Last active
September 12, 2017 07:52
-
-
Save davidfuhr/e008aa1ec71450a2877d23266dd4227e to your computer and use it in GitHub Desktop.
copy remote postgres db to localhost
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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