开发者

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

开发者 https://www.devze.com 2023-01-11 16:43 出处:网络
I am trying to move a database from my old server to a new server. Any help would be appre开发者_运维技巧ciated.Just pipe a dump from the old server into the new one:

I am trying to move a database from my old server to a new server. Any help would be appre开发者_运维技巧ciated.


Just pipe a dump from the old server into 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're using different versions of PostgreSQL, make sure you use pg_dump and psql from the latest version.


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

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号