Issue
After trying to install the MySQL Governor feature, MySQL/MariaDB service is unable to start with the following error even after reverting the changes and installing the original packages:
[Warning] Can't create test file /var/lib/mysql/XXXX.lower-test
[ERROR] Aborting
systemd[1]: mariadb.service: Main process exited, code=exited, status=1/FAILURE
systemd[1]: mariadb.service: Failed with result 'exit-code'.
systemd[1]: Failed to start MariaDB 10.5.17 database server.
Environment
- CloudLinux
- cPanel/Plesk/DirectAdmin
- MySQL Governor
Solution
This is, in essence, a permissions issue. The MySQL/MariaDB service can't write into the data directory. This usually happens when /var/lib/mysql is a symlink to another restricted location. We need to verify the service file and check if the ProtectHome directive is set to "true":
# grep ProtectHome /usr/lib/systemd/system/mariadb.service
ProtectHome=true
This directive prevents the service from accessing /home, /root and /run/user, thus making it unusable as it can't access its data directory. The solution is to set ProtectHome to "false", reload systemd manager configurations, and restart the service:
# grep ProtectHome /usr/lib/systemd/system/mariadb.service
ProtectHome=false
# systemctl daemon-reload
# systemctl restart mariadb.service
Note: In this example, we referred to MariaDB, but the same is applicable to MySQL.
Other causes
Other potential causes for the problem include hardware-related issues, file system corruption, or quota restrictions specific to the mysql user.
Useful links
Comments
0 comments
Please sign in to leave a comment.