Jay Taylor's notes
back to listing indexlfhck.com - Is there a free tool to convert mysql dump to postgres
[web search]I am trying to move my site from mysql to postgres, I don't know how to do it. Already dumped my mysql database with compatible option. But it's impossible to import the data directly. I wonder if there is a free tool, with GUI to do it
I already tried several perl scripts but they appears to be buggy (no one helped)
:(
5 answers
There is the SQL Data Definition Language (DDL) Conversion to MySQL, PostgreSQL and MS-SQL tool.
Or have a look at this Converting MySQL to PostgreSQL page (mainly mysqldump --compatible=postgresql ...
) as well as How to make a proper migration from MySQL to PostgreSQL.
Try SQLFairy, which seems to be a pretty solid and active project; it has conversion drivers for dozens of database systems, including MySQL and PostgreSQL.
There is a nice introduction here, for instance to convert from a MySQL dump to PostgreSQL compatible dump you need to do the following:
sqlt -f MySQL -t PostgreSQL foo-my.sql > foo-pg.sql
There is also a mysql2postgres Ruby script @ GitHub.
taps is a ruby tool that starts a webservice to transfer data between two databases: http://adamblog.heroku.com/past/2009/2/11/taps_for_easy_database_transfers/
From the site:
Taps is a temporary web service you run on a server that has access to the database you want to export. You can then run the client to connect to that service and pull data out of it in chunks. It works through firewalls, doesn’t require a direct ssh connection, and - best of all - it’s database independent. So you can export from a MySQL database and import to PostgreSQL, or vice versa.
I just completed a seamless conversion from MySQL to PostgreSQL on Linux Mint with py-mysql2pgsql. The whole process, including installation of the python script, took about 5 mins altogether.
Take a look at SQL Workbench. It has a "Data Pumper"-feature, where you can transfer all data from one DB to another. If you have access to both your DBs, that would possibly the best solution.
To quote the website:
SQL Workbench/J is a free, DBMS-independent, cross-platform SQL query tool. It is written in Java and thus it should run on any operating system that provides a Java Runtime Environment.
So, no problem running it on OS X.
Question and answers from http://stackoverflow.com/.