Importing MySQL dump into PostgreSQL 8.2

Started by Jeff Lanzarottaover 18 years ago5 messagesgeneral
Jump to latest
#1Jeff Lanzarotta
delux256-postgresql@yahoo.com

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

#2Chris
dmagick@gmail.com
In reply to: Jeff Lanzarotta (#1)
Re: Importing MySQL dump into PostgreSQL 8.2

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/

#3wido
wido.gg@gmail.com
In reply to: Chris (#2)
Re: Importing MySQL dump into PostgreSQL 8.2

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

#4Andrej Ricnik-Bay
andrej.groups@gmail.com
In reply to: wido (#3)
Re: Importing MySQL dump into PostgreSQL 8.2

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

#5Alan Hodgson
ahodgson@simkin.ca
In reply to: wido (#3)
Re: Importing MySQL dump into PostgreSQL 8.2

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