We have a strange issue where the permission of the MySQL data directory /var/lib/mysql/ automatically changes to 0755 from the correct permission 0751. Can you please confirm whether any components of the cPanel is causing this permission change? The permission of the data directory is currently 0751.
This change isn't applied by the cPanel software. During setup/reboot, MariaDB 10.5 includes a startup script that will change the permissions of the data directory to 755.
rpm -qVv MariaDB-server-10.5.12-1.el7.centos.x86_64 |grep tmpfiles
d /var/lib/mysql 0755 mysql mysql -
When the server reboots, SystemD will initialize the "systemd-tmpfiles" service. In instances where MariaDB installs "tmpfiles.d/mariadb.conf", it will cause the directory to be changed to 755 automatically.
If you would like to override this function provided by MariaDB 10.5 perform the following steps:
- cp -p /usr/lib/tmpfiles.d/mariadb.conf /etc/tmpfiles.d/mariadb-override.conf
- Edit /etc/tmpfiles.d/mariadb-override.conf to change 0755 to 0751 ( 0751 was the previously defined permissions before 10.5 upgrades )
Now during reboots, it will skip "mariadb.conf" because it is a duplicate of a locally defined configuration.