A few months ago, a proposal was published to make WordPress officially support SQLite. After the proposal received a lot of positive feedback from the community, we started working on an implementation to make that happen.
Instead of releasing a separate feature plugin A plugin that was created with the intention of eventually being proposed for inclusion in WordPress Core. See Features as Plugins., it was deemed preferable to implement this as a module in the Performance Lab plugin A plugin is a piece of software containing a group of functions that can be added to a WordPress website. They can extend functionality or add new features to your WordPress websites. WordPress plugins are written in the PHP programming language and integrate seamlessly with WordPress. These can be free in the WordPress.org Plugin Directory https://wordpress.org/plugins/ or can be cost-based plugin from a third-party. As of version 1.8.0 of the Performance Lab plugin, the module is now available for testing.
EDIT: After feedback received in this post’s comments, the SQLIte database integration was also released as a separate, stand-alone plugin available on w.org/plugins/sqlite-database-integration.
We would like to urge hosts, plugin authors, and theme developers to test the implementation and help us move forward with this project – with the hope of merging an SQLite implementation in WordPress Core Core is the set of software required to run WordPress. The Core Development Team builds WordPress. in a future release.
How to test the SQLite implementation
In order to test using an SQLite database instead of MySQL MySQL is a relational database management system. A database is a structured collection of data where content, configuration and other options are stored. https://www.mysql.com/. for your WordPress site, you will need to follow the steps below:
Option 1 – If you are using the Performance Lab plugin on your site:
- Install and activate the Performance Lab plugin on your site.
- Navigate from your dashboard to Settings > Performance.
- Enable the SQLite module, and click “Save changes”.
- As soon as you save your changes, the plugin will automatically copy the
db.php file in your
wp-content folder, copy the data for the current user and site title, and also log you in for a more streamlined experience.
Option 2 – Using the stand-alone plugin:
- Install and activate the SQLite Database Integration plugin on your site.
- Follow the on-screen directions.
- As soon as you click the button to install the SQLite database, the plugin will automatically copy the
db.php file in your
wp-content folder, and you will be redirected to the WordPress-installation screen to set-up your new database.
Important note: When activating SQLite, your site will create an entirely separate and fresh database. We have implemented a basic setup so that you don’t have to go through the installation screens, but nothing else is migrated from the original database beyond that.
Frequently asked questions
Will I lose any data?
No. When you activate the SQLite implementation, a new database is created. Your old database remains unaltered, and when you disable the module, your site gets back to using its previous, unaffected MySQL database.
I had data on my old database, and I don’t see my posts, pages, users, etc, on my SQLite site.
The SQLite implementation does not include a way to migrate data from one database to another. Since this is a proposal for an implementation to be merged in WordPress Core, we need to follow the WordPress Core principles. Data migration Moving the code, database and media files for a website site from one server to another. Most typically done when changing hosting companies. is not something that Core should do; it is clearly plugin territory. Your data remains safely in your previous database, and you can access it again by disabling the SQLite module.
When SQLite gets merged in Core, migration and backup plugins will add support for it.
Will this work if I have another
db.php file in my
Unfortunately not. If your site already includes a
db.php file in the
wp-content folder, you will not be able to test SQLite on your site.
You can check if your site already includes a
db.php file from another plugin by going from your dashboard to the plugins screen and then navigating to the Drop-in tab.
Keep in mind that this limitation only applies because the implementation is in a plugin, and therefore it needs the drop-in file. Once SQLite is part of Core, this will not be the case.
The code for the SQLite implementation was copied from https://github.com/aaemnnosttv/wp-sqlite-db/blob/master/src/db.php by Evan Mattson, which is a fork of the original work on the sqlite-integration plugin by Kojima Toshiyasu. It was then refactored, coding standards were applied, and an integration with the Performance Lab plugin was built.
The SQLite code used has been in use for many years and has been battle-tested. We opted to start with a tried solution instead of starting from scratch because many of the problems we would have encountered have already been addressed and solved in the pre-existing implementation.
Where to report issues and feedback
If there are issues that should be addressed, please create a new issue in the plugin’s GitHub repository. When you do, please be sure to mention your SQLite version. You can find it by going from your Dashboard to Tools > Site Health > Info > Database, while the SQLite module is active.
Props @flixos90 and @olliejones for reviewing this post.