After updating mariadb, my.cnf disappears and a symbolic link appears

Hello everyone, I often encounter such a difficulty after updating mariadb, namely, a file with My.cnf settings disappears, and a symbolic link appears. Accordingly, the parameters are completely reset. What I am doing, deleting a symbolic link, and throw my.cnf reserve file into the directory /etc /mysql. In general, I wonder if there is an opportunity to avoid this after each database update? Thank you . Has anything changed since then?)

cd /etc/mysql && rm my.conf && cp /usr/local/hestia/install/deb/mysql/my-large.cnf /etc/mysql/my.cnf && systemctl restart mariadb && systemctl status mariadb

Hi @bestperson

mariadb-common package does this when installing/updating:

    if ! update-alternatives --query my.cnf | grep --quiet "Value: /etc/mysql/mariadb.cnf"
    then
      update-alternatives --install /etc/mysql/my.cnf my.cnf "/etc/mysql/mariadb.cnf" 500 || true
    fi

That means that if my.cnf is not a symbolic link pointing to mariadb.cnf, it will be recreated.

The solution is to put your config in mariadb.cnf and create the symbolic link.

rm -f /etc/mysql/my.cnf
cp /usr/local/hestia/install/deb/mysql/my-large.cnf /etc/mysql/mariadb.cnf
ln -rsf /etc/mysql/mariadb.cnf /etc/mysql/my.cnf
systemctl restart mariadb
systemctl status mariadb

Thank you, everything is so, of course, it would be good that the creators of the database are somehow thought out so that you do not create a file every time)

I checked, today after updating the database, all settings have been preserved. Thanks a lot!