Convert MySQL to SQlite

0 votes
asked Oct 8, 2010 by mullek

Is it possible to convert from MySQL to SQLite with a free tool on windows?

14 Answers

0 votes
answered Jan 8, 2010 by evgeniy

If you have experience write simple scripts by Perl\Python\etc, and convert MySQL to SQLite. Read data from Mysql and write it on SQLite.

0 votes
answered Oct 8, 2010 by assaf-lavie

Not every DB schema can be converted. MySQL is more complex and feature-rich than SQLite. However, if your schema is simple enough, you could dump it into an SQL file and try to import it / load it into an SQLite DB.

0 votes
answered Oct 14, 2011 by david-d-c-e-freitas

Here are a list of converters:

Link seems down now, so it's only available via a snapshot at archive.org, last updated 2011.


An alternative method that would work even on windows but is rarely mentioned is: use an ORM class that abstracts specific database differences away for you. e.g. you get these in PHP (RedBean), Python (Django's ORM layer, Storm, SqlAlchemy), Ruby on Rails (ActiveRecord), Cocoa (CoreData) etc.

i.e. you could do this:

  1. Load data from source database using the ORM class.
  2. Store data in memory or serialize to disk.
  3. Store data into destination database using the ORM class.
0 votes
answered Oct 23, 2011 by jfly

From this webpage: http://osenxpsuite.net

download SQLite2009 Pro Enterprise Manager

It is free. It can import data from Mysql database. I just converted a 17M database. It is perfect.

0 votes
answered Jan 1, 2012 by infzero

This is a simple converter: http://mysql2sqlite.felipemarques.com.br/ (the site is in brazilian Portuguese)

0 votes
answered Oct 4, 2012 by macario

Sequel (Ruby ORM) has a command line tool for dealing with databases, you must have ruby installed, then:

  $ gem install sequel mysql2 sqlite3 
  $ sequel mysql2://user:password@host/database -C sqlite://db.sqlite
0 votes
answered Oct 29, 2012 by david-lebauer

There is a mysql2sqlite.sh script on GitHub

As described in the header, the script can be used like this:

./mysql2sqlite.sh myDbase | sqlite3 database.sqlite

alternatives

0 votes
answered Oct 9, 2013 by david-benko
0 votes
answered Jan 26, 2015 by stefan

I like the SQLite2009 Pro Enterprise Manager suggested by Jfly. However:

  • The MySQL datatype INT is not converted to SQlite datatype INTEGER (works with DBeaver )

  • It does not import foreign key constaints from MySQL (I could not find any tool that supports the transfer of foreign key constraints from MySQL to SQlite.)

0 votes
answered Oct 26, 2015 by grant-luck

My solution to this issue running a Mac was to

  1. Install Ruby and sequel similar to Macario's answer. I followed this link to help setup Ruby, mysql and sqlite3 Ruby on Rails development setup for Mac OSX
  2. Install sequel

    $ gem install sequel
    

    If still required

    % gem install mysql sqlite3
    

    then used the following based of the Sequel doc bin_sequel.rdoc (see Copy Database)

    sequel -C mysql://myUserName:myPassword@host/databaseName sqlite://myConvertedDatabaseName.sqlite
    

A windows user could install Ruby and Sequel for a windows solution.

Welcome to Q&A, where you can ask questions and receive answers from other members of the community.
Website Online Counter

...