Tuesday, October 30, 2007

MySQL to PostgreSQL

If you want to convert from MySQL to PostgreSQL, use the following command to have mysqldump spit out same SQL:

% mysqldump $DATABASE_NAME -v -nt --compatible=ansi,postgresql --complete-insert=TRUE --extended-insert=FALSE --compact --default-character-set=UTF8 -u $DATABASE_USER -p -r $OUTPUT_FILE

You should then hopefully be able to load this dump into your
PostgreSQL database using

=> \i $OUTPUT_FILE

from within psql.

Still i cannot import tables. I tried without the -nt option and the create statements are not compatible.

© yankandpaste® from: I cannot find that link again, so from my mail i am pasting for my/other people reference.

No comments: