{"id":342,"date":"2026-09-06T11:40:48","date_gmt":"2026-09-06T09:40:48","guid":{"rendered":"https:\/\/www.netlabor.it\/?p=342"},"modified":"2026-11-20T16:28:17","modified_gmt":"2026-11-20T15:28:17","slug":"wordpress-su-sqlite-perche-farlo-e-come-installarlo-senza-mysql","status":"publish","type":"post","link":"https:\/\/www.netlabor.it\/en\/wordpress-su-sqlite-perche-farlo-e-come-installarlo-senza-mysql\/","title":{"rendered":"WordPress on SQLite: Why Do It and How to Install It Without MySQL"},"content":{"rendered":"\n<div class=\"wp-block-bogo-language-switcher\"><\/div>\n\n\n\n<p class=\"wp-block-paragraph\"><em>From Installing WordPress on SQLite \u2014 Fractolog, June 24, 2024.<\/em><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The local installation section has been omitted; technical details were re-verified in November 2026 against plugin version 3.1.3, and the differences are listed at the bottom.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Why Put WordPress on SQLite<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">WordPress was built with MySQL, and for most websites that works just fine. However, there is an entire category of use cases where dragging around a database server is an overhead with zero upside: the personal blog getting fifty visits a day, the local club&#8217;s website, the staging environment you spin up once a month, the client demo, or the portfolio you wish you could back up with a simple <code>cp<\/code>.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">SQLite solves exactly this. It is a database that lives in a single file: no daemon to start, no username and password to configure, no port <code>3306<\/code> to expose, and no separate dumps and restores detached from the rest of your files. Your website becomes a folder. You move it, zip it, commit it to a repository, and the data travels right alongside the code.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The limitations are equally clear: <strong>SQLite supports concurrent reads, but only one writer at a time.<\/strong> On a low-traffic blog you won&#8217;t notice it; on an e-commerce store processing hundreds of orders per minute, you will. The plugin is officially maintained by WordPress.org as a feature plugin, with the stated goal of eventually bringing SQLite support into WordPress core. It is used in production by small sites, though the documentation itself recommends reliable backups and load-testing your workload before making the switch.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">One thing to clarify right away, as it is the most common source of confusion: <strong>the plugin does not migrate an existing site.<\/strong> Activating it creates a separate, empty SQLite database, and WordPress prompts you to run the installation again. Deactivating it brings you back to your previous MySQL database\u2014untouched\u2014while any content created on SQLite in the meantime stays there.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">The Documentation Problem<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">WordPress has a plugin that lets it run on SQLite instead of MySQL. The issue is that setting it up isn&#8217;t entirely intuitive: the documented workflow instructs you to install WordPress on MySQL, install and activate the plugin, and then switch to SQLite\u2014which resets the site back to its initial state anyway.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">If the whole point of using the plugin was to avoid the MySQL dependency in the first place, the official instructions aren&#8217;t much help. In reality, getting it working from scratch without MySQL is easy\u2014it&#8217;s just poorly documented.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">The Procedure<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Start with a freshly extracted WordPress ZIP archive. Download the <code>sqlite-database-integration<\/code> plugin and unpack it inside <code>wp-content\/plugins<\/code>.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Next, there are two less obvious steps:<\/p>\n\n\n\n<ol start=\"1\" class=\"wp-block-list\">\n<li>Copy <code>wp-content\/plugins\/sqlite-database-integration\/db.copy<\/code> to <code>wp-content\/db.php<\/code>. That file contains a few placeholders that the standard installation routine replaces with strings, but it isn&#8217;t actually required: a straight copy works fine as-is.<\/li>\n\n\n\n<li>Copy <code>wp-config-sample.php<\/code> to <code>wp-config.php<\/code> and regenerate the salts. You can use the API URL linked in the file&#8217;s comments, or run <code>wp config shuffle-salts<\/code> via WP-CLI.<\/li>\n<\/ol>\n\n\n\n<p class=\"wp-block-paragraph\">Now visit your site: you should be greeted by the WordPress setup screen, skipping the database configuration step altogether. The database file is created inside <code>wp-content\/database\/<\/code> <em>(see the update section below: starting with version 3.1, the exact path is no longer fixed)<\/em>.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Bonus: Converting from MySQL to SQLite<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">It comes up in several places, so to keep everything together: the plugin that enables SQLite support is not meant for migrating data. There doesn&#8217;t seem to be an official tool for this, though there is one path almost everyone has used without much trouble: <code>mysql2sqlite<\/code>. Its README covers all the instructions you need.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Verification: What Still Holds Up in November 2026<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">The method still works, though the plugin has been rewritten in the meantime. Here is what I checked in the source code of version <strong>3.1.3<\/strong> (released November 3, 2026) and what has changed since the original article.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">What still holds up<\/h4>\n\n\n\n<ul class=\"wp-block-list\">\n<li>The <code>db.copy<\/code> file still exists in the plugin&#8217;s root directory: copying it to <code>wp-content\/db.php<\/code> remains the way to bootstrap without MySQL.<\/li>\n\n\n\n<li>In fact, it is now more robust: the file includes an explicit comment (<em>&#8220;Tweak to allow copy-pasting the file without having to run string-replacements&#8221;<\/em>) and, if the plugin path hasn&#8217;t been replaced, falls back to <code>__DIR__ . '\/plugins\/sqlite-database-integration'<\/code>. Copying the file verbatim now works by design, not by accident.<\/li>\n\n\n\n<li><code>wp config shuffle-salts<\/code> is still the fastest way to generate salts.<\/li>\n\n\n\n<li>Migrating from MySQL remains unofficial, and <code>mysql2sqlite<\/code> is still the only practical option (last commit in 2023, 59 open issues: it works, just don&#8217;t expect active maintenance).<\/li>\n<\/ul>\n\n\n\n<h4 class=\"wp-block-heading\">What needs updating<\/h4>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>The plugin is now on version 3.x, no longer 2.x.<\/strong> The engine was rewritten from scratch with a pure-PHP MySQL lexer and parser: it supports complex joins, subqueries, CTEs, an emulated <code>INFORMATION_SCHEMA<\/code>, and <code>SHOW<\/code>\/<code>DESCRIBE<\/code> clauses. This exists to keep third-party plugins working properly, and it&#8217;s the reason the plugin is far more reliable today than it was two years ago.<\/li>\n\n\n\n<li><strong>Stricter requirements:<\/strong> WordPress 6.4+, PHP 7.2+, the <code>pdo_sqlite<\/code> extension, and SQLite 3.37.0 or higher. If you&#8217;re running an older distro, check this first.<\/li>\n\n\n\n<li><strong><code>DB_NAME<\/code> must be defined and non-empty in <code>wp-config.php<\/code>.<\/strong> You don&#8217;t need an actual MySQL database, but the constant cannot be left undefined. <code>wp-config-sample.php<\/code> already works out of the box.<\/li>\n\n\n\n<li><strong>The database path is no longer <code>wp-content\/database\/.ht.sqlite<\/code>.<\/strong> Since version 3.1, the path is randomized\u2014for example: <code>wp-content\/database\/.ht.020a33c5d9e5407e8e93b43e55abf62e\/.ht.sqlite<\/code>. The actual path is written to <code>wp-content\/database\/db-path.php<\/code> and exposed at runtime via the <code>DB_PATH<\/code> constant. If any custom or backup script of yours relied on the old filename, it won&#8217;t find it anymore.<\/li>\n\n\n\n<li><strong>The default journal mode is WAL<\/strong>, meaning <code>-wal<\/code> and <code>-shm<\/code> files appear alongside the main database file. Any hot backup must include them, otherwise the copied database may end up inconsistent. The safest approach is stopping PHP before copying, or running <code>sqlite3 file.sqlite \".backup out.sqlite\"<\/code>.<\/li>\n\n\n\n<li><strong>Setting an explicit <code>DB_PATH<\/code> in <code>wp-config.php<\/code> is recommended<\/strong>, pointing to a file outside the document root:PHP<code>define( 'DB_PATH', '\/srv\/wordpress-data\/sito.sqlite' );<\/code> An explicit path is not randomized, and its parent directory must be writable by PHP. Note: changing <code>DB_PATH<\/code> points WordPress to a different database\u2014it does not move the existing one.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>About the official workflow:<\/strong> The documented path today is to install the plugin from wp-admin, then go to <em>Settings \u2192 SQLite integration \u2192 Install SQLite database<\/em>. That screen runs checks for the PDO extension, write permissions, and conflicting drop-ins. Still, getting there requires an already working WordPress instance, so the drop-in copy trick remains the legitimate shortcut if you want to skip MySQL right from the start.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>From Installing WordPress on SQLite \u2014 Fractolog, June 24, 2024. The local installation section has been omitted; technical details were re-verified in November 2026 against plugin version 3.1.3, and the differences are listed at the bottom. Why Put WordPress on SQLite WordPress was built with MySQL, and for most websites that works just fine. However, [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"full-width-page-template.php","format":"standard","meta":{"_locale":"en_US","_original_post":"https:\/\/www.netlabor.it\/?p=200","footnotes":""},"categories":[6,12],"tags":[8,13],"class_list":["post-342","post","type-post","status-publish","format-standard","hentry","category-informatica","category-wordpress","tag-informatica","tag-wordpress","en-US","missing-thumbnail"],"_links":{"self":[{"href":"https:\/\/www.netlabor.it\/wp-json\/wp\/v2\/posts\/342","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.netlabor.it\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.netlabor.it\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.netlabor.it\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.netlabor.it\/wp-json\/wp\/v2\/comments?post=342"}],"version-history":[{"count":1,"href":"https:\/\/www.netlabor.it\/wp-json\/wp\/v2\/posts\/342\/revisions"}],"predecessor-version":[{"id":344,"href":"https:\/\/www.netlabor.it\/wp-json\/wp\/v2\/posts\/342\/revisions\/344"}],"wp:attachment":[{"href":"https:\/\/www.netlabor.it\/wp-json\/wp\/v2\/media?parent=342"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.netlabor.it\/wp-json\/wp\/v2\/categories?post=342"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.netlabor.it\/wp-json\/wp\/v2\/tags?post=342"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}