Thread: Importing MySQL dump into PostgreSQL 8.2

Importing MySQL dump into PostgreSQL 8.2

From
Jeff Lanzarotta
Date:
Hello,

I have a MySQL dump file that I would like to import into our PostgreSQL 8.2 database. Is there a way to do this?

Thanks.


-Jeff

Re: Importing MySQL dump into PostgreSQL 8.2

From
Chris
Date:
Jeff Lanzarotta wrote:
> Hello,
>
> I have a MySQL dump file that I would like to import into our PostgreSQL
> 8.2 database. Is there a way to do this?

You'll need to convert the table definitions then the data.

For example, mysql has int(11) columns, postgres only has int columns.

I usually convert the tables, then do a csv dump from mysql:

select * from table into outfile '/path/to/file';

then import into postgres:

\copy table from '/path/to/file'

--
Postgresql & php tutorials
http://www.designmagick.com/

Re: Importing MySQL dump into PostgreSQL 8.2

From
wido
Date:
On 5 oct, 01:06, dmag...@gmail.com (Chris) wrote:
> Jeff Lanzarotta wrote:
> > Hello,
>
> > I have a MySQL dump file that I would like to import into our PostgreSQL
> > 8.2 database. Is there a way to do this?
>
> You'll need to convert the table definitions then the data.
>
> For example, mysql has int(11) columns, postgres only has int columns.
>
> I usually convert the tables, then do a csv dump from mysql:
>
> select * from table into outfile '/path/to/file';
>
> then import into postgres:
>
> \copy table from '/path/to/file'
>
> --
> Postgresql & php tutorialshttp://www.designmagick.com/
>
> ---------------------------(end of broadcast)---------------------------
> TIP 6: explain analyze is your friend

hi! but what happens when somebody sent you a dump file and you can't
convert the tables? all i have is a 116MB sql file, and i won't
convert it by hand :P


Re: Importing MySQL dump into PostgreSQL 8.2

From
"Andrej Ricnik-Bay"
Date:
On 10/13/07, wido <wido.gg@gmail.com> wrote:
> hi! but what happens when somebody sent you a dump file and you can't
> convert the tables? all i have is a 116MB sql file, and i won't
> convert it by hand :P
And chances are no one on the list will do it for you,
either, specially not when you stick out your tongue
at them ...

Use sed or awk, then, or write a perl script...

Others have done similar things, and made their work available.
Have a search on freshmeat or gborg.


Cheers,
Andrej

Re: Importing MySQL dump into PostgreSQL 8.2

From
Alan Hodgson
Date:
On Friday 12 October 2007, wido <wido.gg@gmail.com> wrote:
>
> hi! but what happens when somebody sent you a dump file and you can't
> convert the tables? all i have is a 116MB sql file, and i won't
> convert it by hand :P

Restore it into MySQL and then extract it in whatever form you like. Free
Software is a wonderful thing.

--
Ghawar is dying