Add file 'README.missing-socket-directory'.
This commit is contained in:
parent
1d535c9bdc
commit
07dd71da97
51
README.missing-socket-directory
Normal file
51
README.missing-socket-directory
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
##
|
||||||
|
#
|
||||||
|
# MySQL and MariaDB socket-file/pid-file folder issues – how to fix
|
||||||
|
#
|
||||||
|
##
|
||||||
|
|
||||||
|
# ----------
|
||||||
|
# There are 2 possibilities to force creating a folder on ech boot.
|
||||||
|
# ----------
|
||||||
|
|
||||||
|
|
||||||
|
# ----------
|
||||||
|
#
|
||||||
|
# 1.) Add 'ExecStartPre' directive to systemd service file:
|
||||||
|
#
|
||||||
|
# ExecStartPre=/usr/bin/install -m 755 -o mysql -g root -d /var/run/mysqld
|
||||||
|
#
|
||||||
|
# ----------
|
||||||
|
|
||||||
|
MYSQL_USER=mysql
|
||||||
|
SOCKET_DIR="/var/run/mysqld"
|
||||||
|
MYSQL_SERVICE_FILE="/root/mysql.service"
|
||||||
|
|
||||||
|
perl -i -n -p -e "s&^(PermissionsStartOnly=.*)&\1\n\nExecStartPre=/usr/bin/install -m 755 -o $MYSQL_USER -g root -d $SOCKET_DIR&" $MYSQL_SERVICE_FILE
|
||||||
|
|
||||||
|
|
||||||
|
# ----------
|
||||||
|
#
|
||||||
|
# 2.) Create file /etc/tmpfiles.d/mysql.conf file with content:
|
||||||
|
#
|
||||||
|
# # systemd tmpfile settings for mysql or mariadb
|
||||||
|
# d /var/run/mysqld 0755 mysql mysql -
|
||||||
|
#
|
||||||
|
# see also:
|
||||||
|
# https://www.ryadel.com/en/linux-mysql-mariadb-pid-file-folder-fix/
|
||||||
|
#
|
||||||
|
# ----------
|
||||||
|
|
||||||
|
# Force systemd to create such folder on each startup. We can easily do that following the steps below:
|
||||||
|
#
|
||||||
|
# - Create a new /etc/tmpfiles.d/mysql.conf file with content:
|
||||||
|
#
|
||||||
|
# # systemd tmpfile settings for mysql or mariadb
|
||||||
|
# d /var/run/mysqld 0755 mysql mysql -
|
||||||
|
#
|
||||||
|
cat <<EOF > /etc/tmpfiles.d/mysql.conf
|
||||||
|
# systemd tmpfile settings for mysql or mariadb
|
||||||
|
d /var/run/mysqld 0755 mysql mysql -
|
||||||
|
EOF
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user