Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I 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.

like image 736
ha1ogen Avatar asked Aug 17 '10 02:08

ha1ogen


1 Answers

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.

like image 185
Frank Heikens Avatar answered Nov 30 '22 11:11

Frank Heikens