SwapSQL

How to export a PostgreSQL dump

You need a dump file to convert PostgreSQL to MySQL. Both pg_dump formats work with our converter — plain .sql and custom .dump.

Plain SQL (simplest)

pg_dump -h localhost -U postgres -d mydatabase > dump.sql
gzip dump.sql        # optional: dump.sql.gz is accepted and ~10× smaller

Custom format (smaller, also accepted)

pg_dump -h localhost -U postgres -d mydatabase -Fc -f dump.dump

PostgreSQL running in Docker

docker exec CONTAINER_NAME pg_dump -U postgres mydatabase > dump.sql

Remote / cloud databases (RDS, Supabase, Neon…)

pg_dump "postgresql://USER:PASSWORD@HOST:5432/mydatabase" > dump.sql

Any connection string your psql accepts works with pg_dump too.

Useful variations

Version note

Use a pg_dump that is the same version as your server or newer (pg_dump --version). Older clients refuse to dump newer servers.

Got your file? Convert it to MySQL now →