Moving PostgreSQL (from Windows to Linux)

NOTE: This is a user submitted instruction for reference. Your environment may be different.


Use C:\Program Files\PostgreSQL\8.2\bin\pq_dump to dump the database to a file.

 
C:\Program Files\PostgreSQL\8.2\bin\pq_dump kwokdb > kwokdb.backup 

Then transfer the file to a Linux server.

Under linux:

  • Switch to postgres user*
sudo su postgres 
  • Create blank database*
createdb kwokdb
  • Restore data to new database*
psql -u kwokdb < kwokdb.backup