Migrating MySQL to SQLite

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

I tried using SQLite Migrator, but I do not know where to find ODBC drivers for Mac (Snow Leopard). I found http://www.ch-werner.de/sqliteodbc/ which seems to contain drivers, but they are designed for Power PC.

If someone can give me a step-by-step guide or tell me which of the best tools to do this, I would be grateful.

Thanks.

+7
sql mysql sqlite data-migration macos
source share
7 answers

To make my conversions, I ended up using ODBC from actual access . I think I used it in combination with SQLite Migrator . I never liked it, although it was always awkward. In addition, it was expensive at around $ 80 for these two pieces of software.

If I had to do this again, I would buy SQLiteConverter from SQLabs. I use their SQLite Manager, and although it has a lot of interface problems, this is not the case for database software.

http://www.sqlabs.net/sqliteconverter.php

-one
source share

Perhaps the easiest would be to use mysqldump to unload the original SQL from the MySQL database into a text file, and then use sqlite3_exec () to execute that SQL to populate the SQLite database.

+6
source share

Have you looked at this Perl script ? I did not use it - just quickly searched mysql for sqlite migration and it appeared right up.


Edit (after you answered my comment):

The reverse direction is considered here .

If you intend to do this multiple times, and if data structure changes occur, you might be better off using something like Django (albeit in a very hacky way). With this, I would:

# This three lines are done once django-admin.py startproject mymigrationproject cd mymigrationproject ./manage.py startapp migration # The following lines you repeat each time you want to migrate the data edit settings.py and make the changes to connect to MySQL ./manage.py inspectdb > ./migration/models.py edit ./migration/models.py to reorder tables (tables in which other tables depend on top) mkdir fixtures ./manage.py dumpdata migration > ./fixtures/data.json edit settings.py and make the changes to connect to SQLite ./manage.py syncdb ./manage.py loaddata ./fixtures.data.json 
+1
source share

Here is a list of converters:

<h / "> An alternative method that will work well but is rarely mentioned is to use the ORM class, which abstracts the specific differences in the database for you. for example, you get them in PHP ( RedBean ), Python (Django ORM layer, Storm , SqlAlchemy ), Ruby on Rails ( ActiveRecord ), Cocoa ( CoreData )

i.e. You can do it:

  • Loading data from the source database using the ORM class.
  • Storing data in memory or serializing to disk.
  • Store data in the source database using the ORM class.
+1
source share

You can use the trial version http://www.sqlmaestro.com/products/sqlite/datawizard/

It is fully operational for 30 days.

0
source share

You can get ODBC drivers for Mac OS X from real technology.

http://www.actualtech.com/

To connect to MySQL, you need an ODBC driver for open source databases:

http://www.actualtech.com/product_opensourcedatabases.php

(Disclaimer: I am the author of SQLite Migrator)

0
source share

There is a free ETL product that you can use to transfer data from one db to another. Take a look: http://www.talend.com/index.php

Good luck

-one
source share

All Articles