Could not use /var/log/mysqld-slow.log for logging (error 13 - Permission denied).
General
Escalation
General
Escalation
Description
Environment
percona-server-server-8.0.32-24.1.el9.x86_64.rpm from official percona server repo
Attachments
1
Activity
Show:
Not a Bug
Details
Details
Assignee
Unassigned
UnassignedReporter

Needs QA
Yes
Affects versions
Priority
Smart Checklist
Open Smart Checklist
Smart Checklist

Open Smart Checklist
Created April 24, 2023 at 3:28 AM
Updated March 6, 2024 at 9:43 AM
Resolved April 24, 2023 at 7:34 AM
configuration file /etc/my.cnf:
log_error = /var/log/mysqld.log
slow_query_log_file = /var/log/mysqld-slow.log
if I delete both of these files and restart mysqld service - behavior is different:
log file /var/log/mysqld.log is created with permissions 0640 and ownetr:group mysql:mysql.
log file /var/log/mysqld-slow.log not created and MySQL write warning message to log file /var/log/mysqld.log:
Could not use /var/log/mysqld-slow.log for logging (error 13 - Permission denied). Turning logging off for the server process. To turn it on again: fix the cause, then either restart the query logging by using "SET GLOBAL SLOW_QUERY_LOG=ON" or restart the MySQL server.
=====================
If MySQL server can create /var/log/mysqld.log log file on the startup, when this file is absent, but don`t want to create log file /var/log/mysqld-slow.log ?
Looks like this is bug/inconsistency in the MySQL.
Can you please fix this bug and automatically create both of these files on mysqld startup?
Workaround for this bug:
$ cat /etc/systemd/system/mysqld.service.d/override.conf
[Service]
LimitNOFILE = 8388608
ExecStartPre=+touch /var/log/mysqld-slow.log
ExecStartPre=+chown mysql:mysql /var/log/mysqld-slow.log
ExecStartPre=+chmod 0600 /var/log/mysqld-slow.log
ExecStartPre=+touch /var/log/mysqld.log
ExecStartPre=+chown mysql:mysql /var/log/mysqld.log
ExecStartPre=+chmod 0600 /var/log/mysqld.log
ExecStartPre=+/usr/bin/mysqld_pre_systemd