天天看点

pgsql迁移mysql,将postgreSQL数据迁移到mysql

pgsql迁移mysql,将postgreSQL数据迁移到mysql

I'm looking to grab a few bits of data from musicbrainz db to use in a mysql based app.

I don't need the entire database, and have been looking at 'migrating' postgreSQL to mysql, which it seems lots of people have difficulty with.

Wouldn't it be simplest to just dump the postgreSQL data into a comma-delimited text file, and then import that into mysql?

I'm just getting started with this, and don't even have postgreSQL installed yet, but trying to look ahead at how I'm going to do it.

解决方案

You can use COPY (in the psql client) to dump a single table.

Or you can use pg_dump with the -d parameter. This will cause pg_dump to dump INSERT statements, which you can just execute against your MySQL server. You will obviously need to port the schema first - and assuming the datatypes that are used exist in MySQL.