-
Access your database in remote server as
psql -h '127.0.0.1' -U 'your_user' -d 'your_database'
-
\copy (select * from your_table_name) to 'your_file_name.csv' with csv;
-
Download file in your local machine
scp -i your_pem_file.pem ec2-user@ip_address:/home/your_server_user/your_file.csv /home/your_local_user/Downloads/
-
Access your local database same as step 1
-
Copy data into table from file you have downloaded
\copy your_table_name from '/home/your_local_machine_username/Downloads/file_name.csv' csv;
Last active
February 26, 2020 16:46
-
-
Save khadkarajesh/b4b6ab325f571c14c2902e5806d3143c to your computer and use it in GitHub Desktop.
download postgresql data from remote server to local
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment