Re:

From: Gurudutt <guru(at)indvalley(dot)com>
To: "Peter E(dot) Chen" <pchen3(at)jhmi(dot)edu>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re:
Date: 2001-12-21 04:49:35
Message-ID: 882384001.20011221101935@indvalley.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hello Peter,

Here is a complete procedure for converting from MySQL to PGSQL. You
need to use two scripts

a)my2pg.pl
b)mysql2pgsql.pl

------------------PROCEDURE--------------------------

1) Take the dump of the schema only
mysqldump -d <YOURDBNAME> > /tmp/Tables.sql -p;

2) Convert this sql file into pgsql file using my2pg.pl
perl my2pg.pl Tables.sql > TablesPg.sql

3) Take the dump of data
mysqldump -c -t <YOURDBNAME> > /tmp/Data.sql -p;

4) Convert this sql file into pgsql file using mysql2pgsql.pl
perl mysql2pgsql.pl Data.sql

5) step 4 will create a Data.sql92 file

6) find and replace all occurances of 0000-00-00 with 0001-01-01 using
regular expression, if you have date field in your table structures

7) Start dumping to Postgres

8) create a database <YOURDBNAME> using
createdb <YOURDBNAME>

9) Enter ACTBilling using
psql <YOURDBNAME> --username=postgres

10) At the <YOURDBNAME> prompt type
\i TablesPg.sql

11) All the tables will be successfully created.

12) Next use this command to port the data
\i Data.sql92

13) All the data would be successfully ported.

---------------------END OF PROCEDURE---------------------

Hope it is of use to you.

--
Best regards,
Gurudutt mailto:guru(at)indvalley(dot)com

Life is not fair - get used to it.
Bill Gates

Thursday, December 20, 2001, 9:30:27 PM, you wrote:

PEC> Hey All,

PEC> Can anyone tell me where I can find documention on how to use mysql2pgsql?
PEC> I downloaded the software conversion utility from www.pgsql.com.

PEC> Thanks.

PEC> Peter

PEC> ---------------------------(end of broadcast)---------------------------
PEC> TIP 5: Have you checked our extensive FAQ?

PEC> http://www.postgresql.org/users-lounge/docs/faq.html

In response to

  • at 2001-12-20 16:00:27 from Peter E. Chen

Responses

Browse pgsql-general by date

  From Date Subject
Next Message John Fabiani 2001-12-21 05:03:17 Does postgres support data type BLOB
Previous Message Bruce Momjian 2001-12-21 03:54:18 Re: TOAST performance (was Re: [GENERAL] Delete Performance)