How to move a database from one server to another in PgSQL?

I am trying to move a database from my old server to a new server. Any help would be appreciated.

+3
source share
2 answers

Just pipe dump from the old server to the new one:

pg_dump -h 172.26.76.100 -p 5432 -U username your_db | psql -h localhost -p 5432 -U username your_db 

Replace the IP addresses and there you go. If you are using different versions of PostgreSQL, make sure that you are using pg_dump and psql from the latest version.

+8
source

Reset it to the first server and restore it to the second, using either command line tools or something loke pgAdmin.

+2
source

Source: https://habr.com/ru/post/1760006/


All Articles