Importing records from PostgreSQL to MySQL

Joseph picture Joseph · Apr 20, 2011 · Viewed 12.1k times · Source

Was wondering if anyone had any insight or recommended tools for exporting the records from a PostgreSQL database and importing them into a MySQL database. I believe the table structure is 100% identical.

Thoughts? Thanks!

Answer

Matthew Wood picture Matthew Wood · Apr 21, 2011

The command

pg_dump --data-only --column-inserts <database_name>  

will generate SQL-standard-compliant INSERT statements with all column names listed and one VALUES clause per INSERT. This is the most portable way of moving data from PostgreSQL to any other SQL database.