I have issues starting a MariaDB service on a Centos 7 server, because the directory /var/run/mysqld/
is not created by default, as well as the /var/log/mysqld.log
file.
Creating this directory and file with the correct permissions allow MariaDB to start properly, but on reboot, the directory is deleted and has to be recreated.
/etc/systemd/system/multi-user.target.wants/mariadb.service
will start the script when running service mariadb start
; according to that file, on start it execute /usr/libexec/mariadb-prepare-db-dir
, where I have added the following:
touch /var/log/mysqld.log
chown mysql:mysql /var/log/mysqld.log
mkdir /var/run/mysqld
chown mysql:mysql /var/run/mysqld
The log file is properly created, but not the directory. Why ? How can I create it properly, when the service is started ? I thought about a permission problem, but I do not know where to find more information.
The mariadb is installed directly via yum, and it's version 5.5. Why it's not functional out of the box is beyond me.