Ffile2fix
Sign in Get started

What is a .sqlite file?

A .sqlite file is a complete SQL database stored in a single binary file, used by the SQLite engine. It is built into browsers, phones, desktop apps, Python and PHP projects, and is common in local development and small sites.

Key facts

  • Binary format that starts with the 16-byte header "SQLite format 3" followed by a null byte; also uses the extensions .sqlite3 and .db.
  • MIME type is application/vnd.sqlite3 (application/x-sqlite3 is also seen).
  • Supports databases up to hundreds of terabytes, though most are a few KB to a few GB.
  • In WAL mode the database has companion -wal and -shm files that hold recent changes and must be kept with it.
  • Created by apps through the SQLite library; no separate database server is needed.

How to open a .sqlite file

Windows

Open it with the free DB Browser for SQLite or DBeaver, or with sqlite3.exe from sqlite.org: sqlite3 database.sqlite.

macOS

macOS includes the sqlite3 command, so run sqlite3 database.sqlite in Terminal, or use DB Browser for SQLite or TablePlus for a graphical view.

Linux

Install the sqlite3 package and run sqlite3 database.sqlite, then .tables to list tables and SELECT queries to read data.

Common problems and fixes

"database disk image is malformed"
The file is corrupted, often from copying it while in use or a crash. Work on a copy and run sqlite3 broken.sqlite ".recover" | sqlite3 fixed.sqlite to salvage what can be read.
"database is locked"
Another process holds a write lock, or a crashed process left one open. Close other apps using the file, set a busy timeout in your code, and avoid storing it on network drives.
Recent changes are missing after copying the file
In WAL mode the newest data may still be in the -wal file. Copy the -wal and -shm files too, or run PRAGMA wal_checkpoint(TRUNCATE); before copying.
"file is not a database" (SQLITE_NOTADB)
The file is encrypted (for example with SQLCipher), is empty, or is not SQLite at all. Check the first bytes for the SQLite header and open encrypted files only with the matching key and tool.
"attempt to write a readonly database"
The process lacks write permission on the file or its folder, which SQLite needs for journal files. Give the web or app user write access to both.

Often converted to or from: SQL dump, CSV, JSON, MySQL, PostgreSQL

Frequently asked questions

Is a .db file the same as .sqlite?

Often, but not always; .db is a generic extension used by many programs. If the file starts with 'SQLite format 3', it is a SQLite database regardless of its extension.

How do I export a SQLite database to SQL or CSV?

Run sqlite3 database.sqlite .dump > dump.sql for a full SQL script. For CSV, use .headers on, .mode csv and .output table.csv before a SELECT in the sqlite3 shell.

Can I move a SQLite database to MySQL?

Yes, but the SQL dialects differ. Dump it with .dump, then adjust data types, quoting and AUTOINCREMENT syntax before importing, or export tables as CSV and import those.

See all file types β†’ Β· Browse error fixes β†’