Here's how to export an existing database and import it into another database in postgres. 1. Login to a database machine as postgres user 2. use following to export database pg_dump database-name > filename-dump.out 3. Now create a new database in which the data will be imported, if it does not exist. createdb new-database-name 4. Now import the data into new database psql -f filename-dump.out new-database-name