ha1ogen
ha1ogen

Reputation: 13455

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.

Upvotes: 5

Views: 8787

Answers (2)

Frank Heikens
Frank Heikens

Reputation: 127566

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.

Upvotes: 14

Kees de Kooter
Kees de Kooter

Reputation: 7195

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

Upvotes: 2

Related Questions