PostgreSQL – Migrate Database from Windows to Red Hat (Linux)

migrationpostgresql

I would like to know how I could migrate a postgresql database which is currently in a Windows operating system to Red Hat? I'm a beginner and I don't know where to start.

Thanks .

Best Answer

pg_dump will create a file with the queries that are needed to recreate the state of your database. The file will look like a transaction or write ahead log.

pg_dump databasename > dumpfilename

pg_restore then will use this file to recreate your database. It's also useful to migrate to a newer database version

you could also use

psql newdatabasename < dumpfilename