How to use MySQL as the index database
For smaller Publ sites, the suggested configuration is to use SQLite for the index database, as it is low-maintenance and performs very well due to being in-process and taking advantage of the operating system’s disk cache.
However, sometimes it’s helpful to use a larger-scale database system for the deployment, primarily to gain access to finer-grained locking. This is especially useful in situations where there are many thousands of entries and a desire to keep the site running at full capacity during a reindex.
Here is a configuration snippet that allows you to use MySQL/MariaDB on your Publ site:
Then when running the site, set an environment variable such as:
If migrating from SQLite to MySQL, it is a good idea to create the index first before flipping the configuration:
An alternate way to store the database configuration is to put it into a local db_config.py
file, like so:
but as always it is important to ensure the security of this file; environment-based configuration is traditionally considered to be much easier to secure and prevent mishaps such as accidentally checking it into source control.