Migrate SQLite database data dump to MySQL


Grab the (sqlite) sql dump first:

sqlite3 db.sqlite .dump .quit > dump.sql

Now edit the dump to match the MySQL syntax:

  • replace all double-quotes (“) with grave accents (`)
  • replace “autoincrement” with “auto_increment
  • remove “BEGIN TRANSACTION;” from the beginnig of the dump
  • remove “COMMIT;” from the end of the dump
  • remove all lines containing “sqlite_sequence
  • remove “PRAGMA foreign_keys=OFF;
  • remove all “CREATE TABLE” constructs

Now you can import your new MySQL dump.

Click here to initial idea source

Leave a comment

Your email address will not be published.