在2022年9月份,有建议WordPress正式支持SQLite,目前官方的性能插件Performance Lab 1.8已经集成SQLite实验性功能,可以使WordPress支持SQLite。
WordPress如何使用SQLite?
分两种情况,一是全新的WordPress站点,二是已经有数据的WordPress站点。
全新站点使用SQLite
很遗憾的是,目前不能在安装过程中跳过MySQL相关选项,换句话说,你的服务器还是需要MySQL数据库。
在安装之后再安装Performance Lab插件,启用之后,需要勾选下面的选项:
SQLite Integration
SQLite Integration Enable SQLite Integration (experimental)
Use an SQLite database instead of MySQL.Enabling this module will switch to a separate database and install WordPress in it. You will need to reconfigure your site, and start with a fresh site. Disabling the module you will get back to your previous MySQL database, with all your previous data intact. Warning: Do not activate if your site is implemented in a multi-server environment.
保存后,站点会等待一会儿,然后将管理员自动登出。这时整个站点就启用了SQLite模式,原来的MySQL数据库可以重命名、备份等操作,换句话说,不需要MySQL数据库了,甚至可以卸载MySQL。
已有数据站点使用SQLite
安装Performance Lab插件,启用后与上面一样,启用SQLite Integration
选项,保存。仍然管理员自动登出,自动切换到SQLite模式。
但是不建议对原来的MySQL做移除、卸载等操作,因为已有数据站点目前未经测试是否有其他意外,最好保存数据库为佳。