Bug #92016 mysql 5.7 does not start on reboot on genuine RHEL7
Submitted: 14 Aug 2018 20:47 Modified: 31 May 2019 18:31
Reporter: Steven Jones Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Server: Installing Severity:S3 (Non-critical)
Version:5.7.23-1.el7 OS:Red Hat (RHEL7)
Assigned to: MySQL Verification Team CPU Architecture:x86

[14 Aug 2018 20:47] Steven Jones
Description:
After installing mysql 5.7 I find on reboot the PID directory /var/run/mysqld has been deleted and not recreated on boot. Thus a PID file cannot be created and mysql will not start as a result.

I tried to manually create /var/run/mysqld but "something" deletes it every reboot.

How to repeat:
Every time rebooted.

Suggested fix:
Not known.

There is an entry mysql.conf in /usr/lib/tmpfiles.d/mysql.conf that should in theory re-create the directory? with the right permissions and ownership however this fails to do so (I assume).
[15 Aug 2018 7:02] Terje Røsten
Hi!

Thanks for your report!

I am not able to reproduce. 

Can you post output from these commands:

$ grep -v '#' /usr/lib/tmpfiles.d/mysql.conf

$ rpm -V mysql-community-server

$ rpm -qlv mysql-community-server|grep /usr/lib/tmpfiles.d/mysql.conf

BTW: contents of the file /usr/lib/tmpfiles.d/mysql.conf should be:

d /var/run/mysqld 0755 mysql mysql  -
[15 Aug 2018 20:33] Steven Jones
[root@vuwunicomysqlt3 ~]# grep -v '#' /usr/lib/tmpfiles.d/mysql.conf

d /var/run/mysqld 0755 mysql mysql  -
[15 Aug 2018 20:34] Steven Jones
[root@vuwunicomysqlt3 ~]# rpm -V mysql-community-server
S.5....T.    /usr/lib/systemd/system/mysqld.service
.......T.    /usr/lib/tmpfiles.d/mysql.conf
missing     /var/run/mysqld
[root@vuwunicomysqlt3 ~]#
[15 Aug 2018 20:34] Steven Jones
[root@vuwunicomysqlt3 ~]# rpm -V mysql-community-server
S.5....T.    /usr/lib/systemd/system/mysqld.service
.......T.    /usr/lib/tmpfiles.d/mysql.conf
missing     /var/run/mysqld
[root@vuwunicomysqlt3 ~]#
[15 Aug 2018 20:34] Steven Jones
[root@vuwunicomysqlt3 ~]# rpm -qlv mysql-community-server|grep /usr/lib/tmpfiles.d/mysql.conf
-rw-r--r--    1 root    root                      767 Jun  8 22:23 /usr/lib/tmpfiles.d/mysql.conf
[root@vuwunicomysqlt3 ~]#
[15 Aug 2018 20:36] Steven Jones
Hi,  btw, are you on genuine RHEL7.5?  I find that even though Centos (Oracle Linux?) is supposed to be similar it often isnt.
[15 Aug 2018 21:08] Steven Jones
So from your Q's and my digging the package looks like it is actually installed OK?  The Q is then why is RHEL7 not created the sub-dir
[15 Aug 2018 21:27] Steven Jones
Ok, traced the problem to selinux, basically there should be a selinux policy for mysql?

Its kind of strange but just setting to permissive isnt enough it is after a reboot and set to permissive its OK.  

Its very likely then that all RHEL7 wont be able to run mysql5.7 without turning selinux off unless there is meant to be a security policy?
[16 Aug 2018 0:06] Steven Jones
Set the selinux back to enforcing and rebooted but mysql continues to boot which was un-expected.   Building the prod server to see if I can replicate the problem there.
[16 Aug 2018 1:54] Steven Jones
Just done a second identical server and this went fine so I cannot re-produce this a second time, bugger  :(

I have a call open to RH support to see what they say as I uploaded a sosreport and logs.
[16 Aug 2018 22:15] Steven Jones
Problem back again.
[31 May 2019 18:31] MySQL Verification Team
Hi,

This is not a bug. MySQL 5.7.25 properly installs and works on RHEL7. 

You can contact either MySQL Support or RHEL Support to help you set up everything properly. You can also find some additional info about selinux here:
https://blogs.oracle.com/jsmyth/selinux-and-mysql