Re: Mysql migration to Postgresql - Mailing list pgsql-general

From Craig Ringer
Subject Re: Mysql migration to Postgresql
Date
Msg-id 4B0DDF36.9020400@postnewspapers.com.au
Whole thread Raw
In response to Mysql migration to Postgresql  (mrciken <mik.wen@yahoo.com>)
List pgsql-general
mrciken wrote:
> Hello,
>
> Currently, we are using Mysql: we would like to change. Now, we would like
> to use Postgresql. Only problem is that most of our customer addresses and
> other information are on Mysql.

> Can you help us with this?

There are a few options available to you. This has been extensively
discussed in the archives, which are indexed by Google, so you can find
a lot out with a few Google searches. One of the first hits is:

http://wiki.postgresql.org/wiki/Converting_from_other_Databases_to_PostgreSQL#MySQL

In my opinion, the best option is usually to write a new set of SQL
scripts to create the required tables etc in PostgreSQL, using the same
table and column names etc as your existing MySQL database and adapting
types as appropriate. That will ensure you get a fairly clean, sane
setup in PostgreSQL and also helps make sure you understand the database
you're working with. Once you've run the SQL scripts you wrote to create
the required (empty) tables in the new PostgreSQL database, import just
the data from MySQL into the waiting tables in PostgreSQL. You can do
the data import by loading an SQL dump created in MySQL using "psql"
(though some fixing and conversion may be required), using a script or
database access program connected to both databases at once, or however
else you like.

Doing things this way will let you write a good quality table structure
for PostgreSQL, ensuring that things are done sensibly and handling
issues like converting from AUTO_INCREMENT to sequences properly,
converting any use of full text search, etc. However, you'll want to
read the documentation thoroughly.

Another option is to use one of the automated conversion tools and see
how you go. You can always refine the schema it creates once the
conversion is done. Personally, I've never been happy with the results
of doing things that way, though.

--
Craig Ringer

pgsql-general by date:

Previous
From: Filip Rembiałkowski
Date:
Subject: Re: Mysql migration to Postgresql
Next
From: Craig Ringer
Date:
Subject: Re: limiting resources to users