Created
August 6, 2022 17:56
-
-
Save MarshalOfficial/8f11e4e04a1e2f5e3c313d9aff8e82e5 to your computer and use it in GitHub Desktop.
copy table data from one db to another db in postgres
This file contains hidden or 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
| 1: Create a .pgpass file in the home directory of the account that pg_dump will run as. | |
| hostname:port:database:username:password | |
| chmod 600 ~/.pgpass | |
| 2: sudo -u postgres -i | |
| 3: pg_dump -a -t table_to_copy source_db | psql target_db | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment