views:

262

answers:

2

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.

A: 

Perhaps you want to dump you Database to a SQL script.

Havenard
not really what I'm looking for. I know I can create an outfile from postgreSQL same as from mysql, but with all the talk about 'migrating' from one to the other, I'm wondering if this is for some reason not recommended. Seems like the easiest method to me.
pedalpete
Not sure I got your question, maybe cuz I don't know this "MusicBrainz". I'm reading the site right now... Looks like a public DB, is that it? Is there any reason why your app can't work with both local MySQL and remote MusicBrainz's PGSQL?
Havenard
I'm only looking to get a subset of the data,not the entire thing. So I can dump that into a text file. It's a bit of a pain to create a PGSQL install just to do that, but seems like that might be where I'm at.
pedalpete
Maybe you want to build your own dumper which generate a SQL script for your specific case.
Havenard
+1  A: 

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.

Magnus Hagander