Unix Technical Forum

Importing MySQL dump into PostgreSQL 8.2

This is a discussion on Importing MySQL dump into PostgreSQL 8.2 within the Pgsql General forums, part of the PostgreSQL category; --> Hello, I have a MySQL dump file that I would like to import into our PostgreSQL 8.2 database. Is ...


Go Back   Unix Technical Forum > Database Server Software > PostgreSQL > Pgsql General

Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-09-2008, 11:03 PM
Jeff Lanzarotta
 
Posts: n/a
Default Importing MySQL dump into PostgreSQL 8.2

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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 04-09-2008, 11:04 PM
Chris
 
Posts: n/a
Default 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/

---------------------------(end of broadcast)---------------------------
TIP 6: explain analyze is your friend

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 04-09-2008, 11:06 PM
wido
 
Posts: n/a
Default 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

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 04-09-2008, 11:06 PM
Andrej Ricnik-Bay
 
Posts: n/a
Default 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

---------------------------(end of broadcast)---------------------------
TIP 4: Have you searched our list archives?

http://archives.postgresql.org/

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 04-09-2008, 11:07 PM
Alan Hodgson
 
Posts: n/a
Default 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


---------------------------(end of broadcast)---------------------------
TIP 4: Have you searched our list archives?

http://archives.postgresql.org/

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 05:36 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com