Skip to content
migration.tools
SQLite to MySQL

SQLite to MySQL converter

Move a SQLite database to MySQL or MariaDB when a prototype outgrows a single file. Paste the output of .dump and get MySQL DDL and INSERTs.

Going the other way? MySQL to SQLite

Options

SQLite SQL

MySQL 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 (sqlite3 app.db .dump) 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 MySQL script and run it against a staging database first.

What changes between SQLite and MySQL

INTEGER PRIMARY KEY AUTOINCREMENT becomes BIGINT AUTO_INCREMENT, TEXT becomes LONGTEXT, REAL becomes DOUBLE and BLOB becomes LONGBLOB. Declared types such as VARCHAR(100) or DATETIME are respected.

PRAGMA statements and sqlite_sequence rows are removed; BEGIN TRANSACTION becomes START TRANSACTION; double-quoted identifiers become backticks.

Indexes on TEXT columns get a 255-character prefix length, which MySQL requires.

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 SQLite's procedural language and need a human rewrite for MySQL.

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 get a dump out of SQLite?

Run sqlite3 app.db .dump > dump.sql, then paste or drop dump.sql here.