Wednesday, June 25, 2008

postgres to mysql workflow

postgres to mysql workflow

1. Export database from postgres to plain text sql. You should do this with the pgAdmin III tool by right clicking on the db you want to export and choosing "Backup ..." this will take you to the following screen, where you should select options as displayed below (notice the "Plain" and "Insert" options are checked):


2. Once you have exported your plaintext sql you must create tables in mysql into which you can insert your data. Do this by copying the CREATE statement appearing in the "SQL Pane" (after you have clicked/selected a table) in pgAdmin III into the MySQL query line and execute this. Do this for every table you want to import

3. Now run insert statements ... if you get errors, make sure the table structure of the new table is the same as your old table (and insert statement)

No comments: