Convert PostgreSQL dump to MySQL
|
If you have a PostgreSQL database dump file and want to import to your MySQL database, then first download and install this conversion tool..
http://www.lightbox.ca/pg2mysql.php
If the dump conversion fails, then recreate the dump file in a more compatible format like so..
pg_dump dbname --inserts --format p -f /tmp/newpgdump.sql
If you don't have the original postres db then first create it by importing the dump file..
psql dbname < /tmp/pgdump.sql
Then create a new dump file as above.
Now convert the new dump file to mysqldump..
php pg2mysql_cli.php /tmp/newpgdump.sql /tmp/newpgdump_mysql.sql
Then import it to mysql in the usual way..
mysql -u root -p dbname < /tmp/newpgdump_mysql.sql
Tips: you may need utf8 working in mysql - check these exist in my.cnf if so..
[client]
default-character-set = utf8
[mysqld]
default-character-set = utf8
default-collation = utf8_general_ci
|
Tags: postgresql mysql linux database |
|
|
Back