SQLite Database Integration
Description
Run WordPress on SQLite.
The SQLite plugin is a community, feature plugin. The intent is to allow testing an SQLite integration with WordPress and gather feedback, with the goal of eventually landing it in WordPress core.
The plugin replaces the default MySQL database layer with an SQLite-backed implementation. WordPress continues to use its standard wpdb API while the plugin translates and emulates MySQL queries for SQLite.
What the plugin provides
- No database server. Your site’s data is stored in a local SQLite database.
- Guided setup. The installation screen checks for the required PHP extension, write access, and conflicting database drop-ins before enabling SQLite.
- Purpose-built compatibility. A MySQL parser and emulation layer adapt MySQL syntax and behavior for SQLite.
- Useful diagnostics. SQLite details appear in Site Health, and Query Monitor is supported.
Important: Enabling SQLite creates a separate, empty database; it does not migrate an existing site. If you enable it on a site that uses MySQL or MariaDB, WordPress will ask you to set up the site again. Disabling the plugin reconnects WordPress to the previous database with its data unchanged. Changes made while using SQLite are not transferred.
The plugin requires the PDO SQLite PHP extension and SQLite 3.37.0 or newer.
Faq
What is the purpose of this plugin?
The primary purpose of the plugin is to test WordPress with SQLite and gather feedback, with the goal of eventually including the integration in WordPress core.
Read the original proposal on the Make WordPress Core blog and the call for testing for more context.
Can I use this plugin on my production site?
Yes, but keep reliable backups and make sure SQLite is a good fit for your site’s traffic. SQLite supports concurrent reads but allows only one writer at a time, so MySQL or MariaDB may be a better fit for sites with heavy concurrent write traffic. Test your workload, themes, and plugins before switching.
Will this plugin migrate my existing site to SQLite?
No. Enabling SQLite starts a fresh WordPress installation in a separate database. Your existing MySQL or MariaDB database remains unchanged, but its content is not copied to SQLite.
Disabling the plugin reconnects WordPress to the previous database. Content created while using SQLite is not transferred back.
Where is the SQLite database stored?
By default, the SQLite database is stored in a randomized path under WP_CONTENT_DIR . '/database'. The full path is recorded in db-path.php and exposed by the DB_PATH constant at runtime.
For example:
- Database path:
WP_CONTENT_DIR . '/database/.ht.020a33c5d9e5407e8e93b43e55abf62e/.ht.sqlite' - Recorded in:
WP_CONTENT_DIR . '/database/db-path.php'asreturn __DIR__ . '/...'; - Exposed by:
DB_PATH
The random path makes the database location difficult to guess when it is not otherwise protected. We recommend setting DB_PATH to an explicit, protected path outside the web root that your web server does not expose.
Integrations should always read DB_PATH after WordPress loads instead of assuming a fixed database path.
How can I configure the database location?
To properly secure the SQLite database, define the DB_PATH constant to an explicit path that is protected from public web access. An explicit DB_PATH value is used as-is without randomization. Define it in wp-config.php:
// Use protected DB path that is not exposed by the web server.
define( 'DB_PATH', '/private/wordpress/database.sqlite' );
Caution: An explicit DB_PATH must point to a protected location that your web server does not expose. Store the database outside the web root and make sure it’s protected.
The value of DB_PATH must be an absolute path to the SQLite database file, or :memory: for an in-memory SQLite database. The database directory must be writable by PHP. Changing DB_PATH selects a different database without moving an existing one.
What does the plugin require?
In addition to the WordPress and PHP versions listed above, the plugin requires the PDO SQLite PHP extension and SQLite 3.37.0 or newer. The setup screen also needs write access to the wp-content directory and will detect conflicting database drop-ins.
Where can I submit my plugin feedback?
Feedback helps improve the integration. For troubleshooting, questions, suggestions, or feature requests, open an issue in the SQLite GitHub repository.
How can I contribute to the plugin?
Contributions are welcome through the SQLite Database Integration repository on GitHub.
Does this plugin change how WordPress queries are executed?
Yes. The plugin replaces the default MySQL-based database layer with an SQLite-backed implementation. WordPress continues to use the wpdb API, while queries are internally adapted to SQLite syntax and behavior.
Reviews
Works great on my low-traffic site
By openletter on June 29, 2025
I have no other services requiring MySQL/MariaDB, so this option saves me some memory and headache. Have been running for around one year and zero issues, but my site is very simple.
Util para crear sitios de desarrollo
By ALPRADO WordPress Consultant (alprado) on June 29, 2025
SQlite debería de ser la opción por defecto para WordPress. Es mucho más simple de administrar que mySQL y puede funcionar igual de bien. Este plugin es indispensable para crear un WordPress de desarrollo que solamente necesita PHP para iniciar el servidor sin instalar XAMPP ni otro software.
Great, seems only one step away …
By Gareth Bult (madpenguin) on December 3, 2024
Ok, so in terms of doing what it says in the tin, for me it looks great. I’ve set up 20 – 30 instances, it runs my core plugins and has a footprint of ~ 105M when running with a default setup. Seems to be at least as fast as the MySQL instances sat next to them.
Here’s the problem tho’. It would seem I can’t actually convert any existing sites over to run on these instances without a lot of manual work. (I say this after reading the experiences of some others who claim to have tried).
Are there any relatively automatic tools and/or documentation that I might have missed when it comes to migrating a MySQL instance over to SqLite (and back, in the event of a problem), or at least a Roadmap of if / when such tools or plugins might become available?
A roadmap or estimation might at least (if it’s a long way away) prompt someone to get on and do it?
First start
By barbaroshh on November 26, 2024
I added this plugin. WordPress warned me that it would be reinstalled. But now everything is gone.) Will it come back, hopefully?
Great Plugin! Makes WP so fast!
By John Turner (johnnytee) on September 28, 2024
Thank you dev team for providing this plugin !
Excellent!
By lucasbustamante on August 26, 2024
I used it to spin up a test site in CI, it’s just elegant and brings WP closer to Static when we need it. There’s a place for SQLite simplicity in some WP workflows. Loved it!
Working Fine for Me
By Terry J (texasbiz) on July 23, 2024
Great start to a well needed SQLite option.
Installation was smooth for a fresh installation with no content. Using PHP 8.2 and WordPress 6.6.
Thank you, team for sharing and getting this into production.
سایتی بدون تنظیمات دیتابیس
By پدرام رحیمی (pedramrahimi) on November 27, 2023
با این افزونه در واقع سایت شما قلمبه کپی میشه و همه جا منتقل میشه و کار می کنه بدون اینکه نیازی به ساخت و تنظیم دیتابیس باشه. همه چیز در یک فایل کنار فایل های وردپرس ذخیره میشه
Excelente idea
By ximo (joaquinsae) on October 20, 2023
una gran idea
Requiring PDO_SQLITE is WRONG !
By eragonsoftware on September 13, 2023
I consider the fact that the coders of this module require the presence of the PDO_SQLITE module on the server, to be wrong.
Why not simply use the native sqlite module, which is not tied to PDO ?
What’s wrong with that one ?
On a regular shared hosting, having PDO_SQLITE turned on can be a PITA, while the “regular” sqlite extension is almost always present, so why not use that one ?
I’m just sayin…
Changelog
3.1.1
- Support date arithmetic with
INTERVALoperators (#539) - Fix
ROLLBACKas the first transaction of a connection (#537) - Fix matching a foreign key reference to a unique key with a different case (#534)
- Fix
FOUND_ROWS()withoutSQL_CALC_FOUND_ROWS(#533) - Fix unique keys and foreign key restore without stringified fetches (#532)
- Fix
CREATE TEMPORARY TABLE IF NOT EXISTSandDROP TEMPORARY TABLEas the first temporary table (#524) - Fix a warning for a foreign key referencing a table with a shorter unique key (#523)
- Fix temporary table lookup without stringified fetches and with a different case (#522)
3.1.0
SQLite Database Integration 3.1 is here! 🎉
This release improves database storage and configuration and fixes several MySQL compatibility issues.
What’s new
Version 3.1 improves how WordPress sites store, locate, and protect their SQLite databases. It also fixes SQL behavior and export compatibility:
- Randomized database paths: The default database location is now a randomized directory under
wp-content/database/, recorded inwp-content/database/db-path.php. (#502) DB_PATH: Configure the database with one full-path constant, also available at runtime for integrations. (#512)- SQL compatibility: Fix
IF()condition evaluation and makeTRADITIONALenable its component SQL modes. (#518, #509) - WordPress table collations: Default to
utf8mb4_unicode_520_cifor new tables created with WordPress’s charset settings, improving exports to MariaDB. Existing tables keep their recorded collation. (#514) - Documentation: A new plugin README and expanded FAQ explain database storage and secure configuration. (#520)
For more information about database paths and secure configuration, read the database storage guide.
Upgrading to 3.1
Upgrading an existing SQLite site is straightforward:
- Back up your SQLite database.
- Update the plugin to version 3.1.
Existing .ht.sqlite and .ht.sqlite.php databases move to the randomized layout automatically unless a database file path is explicitly configured.
To properly secure the database, set DB_PATH in wp-config.php to an absolute file path outside the web root that your web server does not expose. Its directory must be writable by PHP. Changing DB_PATH does not move an existing database.
Breaking changes
Review these changes if you use custom database settings or integrations:
- Database paths: Default database files now move to randomized paths under
wp-content/database/. Explicitly configured file paths stay unchanged. Integrations, including backup and migration tools, must readDB_PATHafter WordPress loads instead of assuming a fixed filename. - Legacy constants:
DB_DIRandDB_FILEare now deprecated. They and the previously deprecatedFQDBandFQDBDIRremain supported, butDB_PATHtakes precedence. Conflicting values trigger warnings. - Absolute paths: Relative database file and directory paths are now rejected.
:memory:remains available for in-memory databases.
Thank you
Thank you to everyone who contributed, tested, and helped update integrations.
Changes since 3.0.2: v3.0.2...v3.1.0
3.0.2
- Fix schema reconstruction with native numeric results (#506)
- Fix lexer edge cases and string handling (#505)
- Preserve index prefix lengths and order in
SHOW CREATE TABLEprimary keys (#500) - Align savepoint handling with MySQL semantics (#496)
3.0.1
3.0.0
SQLite Database Integration 3 is here! 🎉
This release introduces an all-new SQLite database driver for WordPress, rebuilt from the ground up. Its purpose-built MySQL lexer, parser, and emulation layer deliver broader compatibility, more accurate behavior, and a stronger foundation for future improvements.
The 3.0 release spans nearly two years of work, featuring 160 pull requests and 1,075 commits from 15 contributors.
What’s new
The new driver advances SQLite support for WordPress, plugins, database tools, and other MySQL-based applications. These improvements include:
- New SQL engine: The pure-PHP lexer and parser provide extensive coverage of the official MySQL grammar.
- Broad query support: Complex joins, subqueries, CTEs, unions, and other advanced queries are now supported.
- Schema emulation: WordPress and database tools can query emulated MySQL
INFORMATION_SCHEMAtables. - Schema introspection:
SHOWandDESCRIBEstatements provide accurate MySQL-like metadata. - Improved data handling: Types, casts, defaults, auto-increment, values, and escaping better match MySQL.
- Refined MySQL semantics: Better emulation of SQL modes, variables, functions, transactions, and errors.
- Better concurrency: Write-ahead logging and fewer locks reduce blocking between readers and writers.
- PDO API: The new driver implements the PDO MySQL API, supporting many MySQL-based tools and applications.
- Extensive testing: Test suites cover parsing, translation, metadata, concurrency, PDO, and end-to-end workflows.
For more information about the new driver and its architecture, read the driver announcement.
Modular design
The project was redesigned as a set of focused packages, separating the core driver from its WordPress integration:
- SQLite Database Integration: The WordPress plugin powered by MySQL on SQLite.
- MySQL on SQLite: A standalone PDO MySQL drop-in for running MySQL-based PHP applications on SQLite.
- MySQL proxy (experimental): A MySQL wire protocol bridge to PDO-compatible drivers for clients outside PHP.
This architecture opens the driver to new integrations, applications, and development tools beyond WordPress.
Upgrading to 3.0
Upgrading an existing SQLite site is straightforward:
- Back up your SQLite database.
- Update the plugin to version 3.0.
On first connection, the new driver automatically initializes its metadata without changing your tables or content.
If you used the new driver preview, you can now delete the WP_SQLITE_AST_DRIVER flag.
Breaking changes
Most WordPress sites need no changes. Review the following if you use a custom setup:
- New driver:
- The new driver is always used. The legacy driver was removed.
- The
WP_SQLITE_AST_DRIVERfeature flag was removed.
- Updated SQLite version requirements:
- SQLite
3.37.0or newer is required. - The
WP_SQLITE_UNSAFE_ENABLE_UNSUPPORTED_VERSIONSopt-in enables limited SQLite3.27.0–3.36.xsupport.
- SQLite
DB_NAMEis required:- It must be defined and non-empty.
- It is used dynamically, independently of the SQLite file name and stored metadata.
- SQLite defaults have changed:
- Updated configuration constants:
DATABASE_ENGINEwas removed. UseDB_ENGINE.DATABASE_TYPEis deprecated. UseDB_ENGINE.FQDBDIRis deprecated. UseDB_DIR.FQDBis deprecated. UseDB_DIRandDB_FILE.
- Updated driver classes:
WP_SQLite_Driveris deprecated. UseWP_MySQL_On_SQLite.WP_PDO_MySQL_On_SQLitewas replaced byWP_MySQL_On_SQLite.WP_SQLite_Driver_Exceptionwas replaced byWP_MySQL_On_SQLite_Exception.WP_PDO_Proxy_Statementwas replaced byWP_MySQL_On_SQLite_Statement.
- Sunsetting
$GLOBALS['@pdo']:- Injecting a PDO connection through
$GLOBALS['@pdo']is no longer supported. - Reading
$GLOBALS['@pdo']is deprecated. Use$wpdb->get_driver()->get_sqlite_pdo().
- Injecting a PDO connection through
- Renamed driver constructor options:
pdosqlite_pdo.journal_modesqlite_journal_mode.synchronoussqlite_synchronous.
Thank you
Thank you to everyone who helped build, test, review, and improve the new driver. Your work made this possible.
3.0 milestone: 160 pull requests
Changes since 2.2.23: v2.2.23...v3.0.0
2.2.23
2.2.22
- Support INSERT without INTO keyword (#354)
- Add tests for MySQL row-level locking clauses (#342)
- Improve automated deploy setup.