After a small update ran by an Ansible playbook from MariaDB 10.5.4
to MariaDB 10.5.5
, the custom configuration file got silently overriden by the default configuration causing the server to refuse connection because the valid custom configuration was no longer present.
Our custom configuration file was stored under /etc/mysql/my.cnf
My question is: What is the best practice to store the custom configuration so it never again gets replaced by the default one when an update comes out
Is it /etc/mysql/conf.d/
?
Distribution: Debian 10 installed with the official repository: https://downloads.mariadb.com/MariaDB/mariadb-10.5/repo/debian
Yes, you're meant to leave the default configuration alone and place your configuration snippets in files in
/etc/my.cnf.d/
(the location used by MariaDB upstream) or Debian's nonstandard location/etc/mysql/mariadb.conf.d/
or wherever your particular MariaDB packages locate this directory.I would suggest creating an ansible patches role that will store you customized my.cnf file and in case it does not match content will be updated.
Our best practice we do is to run a patch role after every update is done to ensure all customizations will be in place. It saved us a lot of time with this practice.