Skip to content
migration.tools
MySQL to SQLite

MySQL to SQLite converter

Convert a MySQL dump into a script SQLite can import — for local development, embedded apps, tests or shipping a read-only copy of your data.

Going the other way? SQLite to MySQL

Options

MySQL SQL

SQLite SQL

The result appears here as soon as there is input.

Processed on this device. Nothing you paste or drop is uploaded.

How to use it

  1. 1Export your database (mysqldump or phpMyAdmin) and paste the SQL, or drop the .sql file.
  2. 2Read the review notes under the output — they list everything that needs a human decision.
  3. 3Download the SQLite script and run it against a staging database first.

What changes between MySQL and SQLite

An AUTO_INCREMENT primary key becomes INTEGER PRIMARY KEY AUTOINCREMENT, the only form SQLite supports.

Column types collapse to SQLite's storage classes: integers to INTEGER, decimals to NUMERIC, floats to REAL, text and dates to TEXT, binary to BLOB. ENUMs become TEXT with a CHECK constraint.

Foreign keys are written inside CREATE TABLE, because SQLite can't add them afterwards. KEY definitions become separate CREATE INDEX statements, and MySQL table options are dropped.

What to check before you run it

Run the converted script against an empty staging database first, inside a transaction if the target supports transactional DDL. The review notes under the output list every statement that was dropped, every type with no direct equivalent and every clause that needs a manual decision.

Views, triggers, stored procedures and functions are passed through unchanged and flagged. Their bodies are written in MySQL's procedural language and need a human rewrite for SQLite.

After loading, compare row counts table by table. For a deeper check, export a table from both databases and run the two files through the CSV compare tool.

Questions

How do I load the result?

Run sqlite3 app.db < converted.sql, or paste it into any SQLite client. Add PRAGMA foreign_keys = ON; in your application if you want the foreign keys enforced.