9

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

4 Answers 4

15

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.

Sign up to request clarification or add additional context in comments.

4 Comments

which PostgreSQL client program is best?
well, pg_restore is one of the cli utilities supplied with postgresql. I generally use psql for working with the server. Some people really like pgadmin, I don't to the extent I'm trying to write my own desktop client. ymmv.
For anyone using bash who would like to save the output to file, use: pg_restore dumpfile.pg > my_file.sql
@a_horse_with_no_name: ?? the OP wanted to convert a PostgreSQL dump file to something else. The default operation mode of pg_restore is to read a dump file and convert it to plain SQL. Although MySQL can't read that directly, it's at least then in a state to be hacked by script etc.
8

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

Comments

0

Check this link ... probably of help

http://www.weberp.org/HowToConvert

Also, check this links

http://dbconvert.com/convert-mysql-to-postgresql-pro.php

https://stackoverflow.com/questions/1884060/is-there-a-free-tool-to-convert-mysql-dump-to-postgres

Comments

0

A google search yielded a reference to this discussion. It looks hopeful and maybe it will help.

HTH

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.