/var/run/mysqld not present after reboot

Symptoms: after installation Mysql UP and work properly, but after first reboot isn't start because can't create pid/socket in /var/run/mysqld
Root cause is deb package create /var/lib/mysqld during installation

percona-xtradb-cluster-server-5.7_5.7.25-31.35-1.stretch_amd64.deb/deb://DEBIAN/preinst
...
MYSQLRUN=/var/run/mysqld
...
if [ ! -d ${MYSQLRUN} -a ! -L ${MYSQLRUN} ];
then
    mkdir ${MYSQLRUN}
    chown mysql:mysql ${MYSQLRUN}
    chmod 755 ${MYSQLRUN}
fi
...
but after reboot, /run (/var/run is symlink to /run) recreated from scratch and /var/run/mysqld directory not present anymore. For Debian/Ubuntu/Centos correct way for solve this problem is tmpfiles.d
#cat /etc/tmpfiles.d/mysqld.conf
d    /var/run/mysqld    0755    mysql    mysql    -    -

Comments

Popular posts from this blog