Transfer MySQL to SQLite

nevan king picture nevan king · Nov 3, 2009 · Viewed 11k times · Source

I want to start using Core Date on iPhone with pre-existing MySQL databases. What's the easiest way to transfer a MySQL database to SQLite?

I've tried using SQLite Migrator, but I don't know where to find the ODBC drivers for Mac (Snow Leopard). I found http://www.ch-werner.de/sqliteodbc/ which seems to have drivers, but they are for Power PC.

If someone could give me a walkthrough, or tell me what the best tools for this are, I'd be grateful.

Thanks.

Answer

Mike Willekes picture Mike Willekes · Nov 5, 2009

Perhaps the simplest would be to use mysqldump to dump the raw SQL from your MySQL database into a text file and then use the sqlite3_exec() function to execute that SQL in order to populate the SQLite database.