views:

924

answers:

10

Hi!

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)

:(

+1  A: 

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.

Mark Carey
A direct link to the source on github: http://github.com/ricardochimal/taps
Mark Carey
A: 

how about using pentaho's kettle (data integration)? it's kind of like microsoft's data transformation services, but more powerful and free. http://kettle.pentaho.org/

we use it for many things, including to pull data from mssql into mysql.

Peter Carrero
A: 

Database Comparer can do the job and it make me well for me

Hugues Van Landeghem
A: 

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.

Sven Lilienthal
A: 

I found this and this for manual conversion, but I suppose you already tried something similar without success.

You could try a tool like Aqua Data Studio. It runs on OS X, it isn't free, however you can evaluate it for 14 days. It has a graphical interface that will allow you to export/import tables (both from MySQL and PostgreSQL) either as files or as insert statements.

kgiannakakis
Installed Aqua Data Studio. Could you please suggest further steps?Seems it supports only per tables export (I mean export data menu item), but what if I need to use it will all db?
Oleg Tarasenko
I don't think full database back up is supported, but I am not 100% sure about it.
kgiannakakis
A: 

I use SQL::Translator for this sort of thing.

From the output of running sqlt with no arguments:

To translate a schema:

  sqlt -f|--from|--parser MySQL
       -t|--to|--producer Oracle
       [options]
       file [file2 ...]
David Dorward
Please drop more info. How to convert my dump from mysql to postgres using it?
Oleg Tarasenko
But how to trnslate the data itself? E.g. I have dump called db.sql
Oleg Tarasenko
A: 

There are a number of programs and scripts that look like they will convert your mysql dump file to postgres at the PostgreSQL Wiki. I've never needed to use any of them so I can't attest to how they work, but probably isn't a bad place to start.

They're almost all the way down under the title MySQL.

munch
+1  A: 

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.

Alix Axel
Just tried. Got an error:oleg@vds:~$ sqlt sqlt -f MySQL -t PostgreSQL japan_inn.sql > japan_inn_psql.sqlUse of uninitialized value $text in substitution (s///) at (eval 245) line 90.Use of uninitialized value in substr at /usr/share/perl5/Parse/RecDescent.pm line 113. ERROR (line 1): Invalid statement: Was expecting comment, or use, or set, or drop, or create, or alter, or insert, or delimiter, or empty statementError: translate: Error with parser 'SQL::Translator::Parser::MySQL': no results at /usr/bin/sqlt line 327.oleg@vds:~$
Oleg Tarasenko
A: 

Take a look at EnterpriseDB migrator - it's not free, but probably worth looking at.

filiprem
+2  A: 

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.

Gregory Pakosz