/var/run/mysqld not present after reboot
Symptoms: MySQL starts correctly after installation, but fails to start after the first reboot because it cannot create the PID/socket in /var/run/mysqld.
Root cause: the Debian package creates /var/run/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
...
After a reboot, /run (symlinked from /var/run) is recreated from scratch, so /var/run/mysqld no longer exists. The correct way to fix this on Debian/Ubuntu/CentOS is to use tmpfiles.d:
# cat /etc/tmpfiles.d/mysqld.conf
d /var/run/mysqld 0755 mysql mysql - -
Human Logic, AI Syntax...
Note on Content: I'm a Systems Engineer, not a native English writer. To ensure my technical ideas are clear and accessible, I use AI tools to polish the grammar and style. The workflow is simple: I provide the logic, the code, and the real-world experience. The AI handles the "English-to-Human" translation layer. If you find a bug, that's on me. If you find a perfectly placed comma, that's probably the AI.
Comments
Post a Comment