I've installed MySQL 5.6 on a CentOS 7 server and I'm trying to change the error log location from the default /var/log/mysql.log
to /var/log/mysqld.err
. MySQL is running properly when I use the default file location, but the systemd service fails with err 13 - Permission Denied
when I try to change the logfile location. I made sure to set the file access permissions and owner/group and restart the service with the following:
chown mysql:mysql /var/log/mysqld.err
chmod 640 /var/log/mysqld.err
systemctl daemon-reload
systemctl restart mysql
but the mysqld service still fails with the Permission Denied error when it tries to log output into /var/log/mysqld.err
.
I've even tried setting the file access permissions on /var/log/mysqld.err
to 777. In this case, the mysqld_safe
script was able to write to the logfile successfully when I ran it manually, but the systemd service still fails even though I allowed any user to edit the file.
Are there settings other than file access rights and owner/group settings that limit what files a systemd service can access? As a side note, I have made no modifications to the service script that is installed from the MySQL repo, nor have I added any overwrite files for the service.
/var/log/audit/audit.log
for denied entries as well as checking what givessemanage fcontext --list |grep mysql
would give some informations about thischcon -v --reference=/var/log/mysql.log /var/log/mysqld.err