WordPress on SQLite
WordPress usually works with MySQL or MariaDB, but SQLite is also supported, although not officially.
In this note, we will look at how to install WordPress with SQLite and when it might be useful.
PHP with SQLite3 support
Make sure that the sqlite3
extension is enabled on the server. Check this via phpinfo()
or the command:
php -m | grep sqlite3
If the extension is missing, activate it in php.ini:
extension=sqlite3
Restart the server (Apache/Nginx).
For those who have Laragon installed, it's enough to activate it through the interface:
Download and unpack WordPress
Download WordPress and unpack it in the desired location on your server.
You can use curl:
# Download WordPress to the current folder curl -O https://wordpress.org/latest.tar.gz # Unpack the archive tar -xzvf latest.tar.gz
Or via the WP CLI command
wp core download
Working with the SQLite Database Integration plugin
Download the SQLite Database Integration plugin and unpack it in the /wp-content/plugins/
folder so that the plugin files are located at /wp-content/plugins/sqlite-database-integration/
You can also do it from the command line
# Execute in the plugins folder curl -LO https://downloads.wordpress.org/plugin/sqlite-database-integration.latest-stable.zip # Unpack right away tar -xf sqlite-database-integration.latest-stable.zip
After that, copy the db.copy
file from the plugin folder to the /wp-content/
folder and rename it to db.php
. As a result, there should be a file at the path /wp-content/db.php
.
You can do it with the command:
cp sqlite-database-integration/db.copy ../../wp-content/db.php
Now this file is the SQLite client that WordPress will use to connect and make queries to the database.
Configuring wp-config.php
Out of the box, there is no wp-config.php file, and you cannot create it even through WP CLI, as a connection to a MySQL database is required, which we do not have and will not have. Therefore, simply create the wp-config.php
file from the wp-config-sample.php
file manually or with the command:
# Executed at the level of these files cp wp-config-sample.php wp-config.php
Optional step. Now inside, find the constants responsible for the database connection and delete them. They are not used anyway. This will be convenient so that no one has questions in the future.
/** The name of the database for WordPress */ define( 'DB_NAME', 'database_name_here' ); /** Database username */ define( 'DB_USER', 'username_here' ); /** Database password */ define( 'DB_PASSWORD', 'password_here' ); /** Database hostname */ define( 'DB_HOST', 'localhost' ); /** Database charset to use in creating database tables. */ define( 'DB_CHARSET', 'utf8' ); /** The database collate type. Don't change this if in doubt. */ define( 'DB_COLLATE', '' );
We can add various configurations here that override the plugin's operation, but for a basic installation, none of that is required.
Installing WordPress
Go to the site in the browser, by the domain you have set up. You will see the launch of WordPress and the familiar installation process.
Result
After installation, files will appear in the wp-content/database/
directory:
File Name | Size | Content |
---|---|---|
.ht.sqlite | 1Mb | The database itself |
.htaccess | 13 byte | DENY FROM ALL |
index.php | 28 byte | <?php // Silence is gold. ?> |
The most important thing is a working WordPress. However, there are nuances in operation. We will discuss them later.
This article will be updated as problems arise and their solutions.
Pros and Cons
Pros:
- Ease of deployment — does not require a separate database server.
- Ease of backup and migrations — everything is stored in a single .sqlite file.
- Performance on small sites — excellent performance under low load.
- Suitable for local development — convenient for quick testing.
- Minimum dependencies — no need for MySQL/MariaDB.
Cons:
- Scalability limitations — poorly performs under high query competition.
- Compatibility - WordPress does not officially support SQLite, third-party plugins are needed (SQLite Database Integration is still third-party).
- Difficulties with plugins and themes — some do not work due to the specifics of SQL queries.
- Lack of replication and clustering — unsuitable for high-load projects.
- Limited community support — few ready-made solutions for SQLite + WP.
- Sparse documentation - there are practically no decent instructions, information has to be gathered from forums.
- Partial incompatibility with WP-CLI — some commands (for example, import/export) access MySQL directly, bypassing wpdb, so they do not work with SQLite.
Why might this be needed?
Sometimes WordPress on SQLite is just convenient. For example, when you need to create a business card site or a simple project "packed in December — and handed over to the client". Setting up a full-fledged database and configuring migrations for this is pointless. SQLite allows you to avoid this extra hassle.
It is also an excellent solution for personal projects or development "for fun" — for example, when you are working with APIs (VK, Kinopoisk, etc.), collecting data, testing AI, or implementing simple searches. While data can be stored in JSON — that's fine, but when you need a complete structure and flexibility — SQLite perfectly replaces MySQL, without requiring a server.
This is especially convenient if the project is not critical, but you want a database "in one file", without unnecessary dependencies and hassle with backups.
And here is a list of options where this might come in handy:
- For local development without MySQL.
- For lightweight sites with low load.
- For testing plugins and themes.
- For learning and experiments.
- For prototyping sites.
- For offline demonstrations without a server.
- For CI/CD environments with minimal dependencies.
- For static site generation (via plugins).
- For portable builds, everything in one folder.
- For servers without MySQL/MariaDB.
- For cheap hosting with limitations.
- For backups — simplified backup processes.
- For security — fewer vectors for SQL injections.
- For ease of installation and migration.