Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Convert PostgreSQL dump file to MySQL?

I want to convert a PostgreSQL dump file I received to a MYSQL dump file or even sql text to be generated?

like image 671
Norm Avatar asked Jan 05 '12 17:01

Norm


2 Answers

If you install the PostgreSQL client programs, you can use "pg_restore" to convert a dump file to a SQL script without having to have a PostgreSQL instance. Just do pg_restore dumpfile.pg and it will print the restore SQL to stdout.

like image 63
araqnid Avatar answered Sep 30 '22 11:09

araqnid


If you have PostgreSQL installed on your terminal and your file is latest.dump you just need to convert it to latest.sql this way:

$ pg_restore latest.dump > latest.sql

like image 28
Tim Truston Avatar answered Sep 30 '22 10:09

Tim Truston