I'm troubleshooting a MySQL no-start on CentOS 7 VM. It is a bit unusual to see this since we have not made any configuration changes. The manual start command was taken from systemd logging. The error is the age old:
# /usr/bin/mysqld_safe --basedir=/usr
181221 17:42:49 mysqld_safe Logging to '/var/log/mariadb/mariadb.log'.
181221 17:42:49 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
/usr/bin/mysqld_safe_helper: Can't create/write to file '/var/log/mariadb/mariadb.log' (Errcode: 13)
According to Red Hat Bugzilla – Bug 1061045, mysql:mysql
needs the appropriate permissions, which we seem to have:
[root@ftpit w]# ls -Al /var/log
total 52764
...
drwxrwx--- 2 mysql mysql 4096 Aug 16 11:05 mariadb
And:
[root@ftpit w]# ls -Al /var/log/mariadb/
total 99852
-rw-rw---- 1 mysql mysql 102138776 Dec 21 17:16 mariadb.log
And:
[root@ftpit w]# grep mysql /etc/passwd
mysql:x:27:27:MariaDB Server:/var/lib/mysql:/sbin/nologin
I also tried g-w
as shown in the bug report.
Where should I look next for this error? Or how do I fix it?
Best Answer
Is SELinux running in enforcing mode? Run
sestatus
to find out. If so, it should be logging to the/var/log/audit/
directory. You can dogrep mysql /var/log/audit/*
to see if there are any problems related to "mysql" i.e. MariaDB.Also, the correct privileges and SELinux context for the log directory and files are:
For instructions on how to set the right SELinux context, refer to the documentation: What to Do if MariaDB Doesn't Start - SELinux and MariaDB Path Changes.