MariaDB - pidfile location - defect init script
Start MariaDB - pid-file is written in datadir, but expected in /run/mysqld
- /etc/init.d/mariadb start
* Starting mariadb.org …
160428 13:28:21 mysqld_safe Logging to syslog.
160428 13:28:21 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql [ ok ] - /etc/init.d/mariadb.org status
* status: crashed - ps -ef | grep 3306
5475 mysql 0:00 /usr/bin/mysqld —basedir=/usr —datadir=/var/lib/mysql —plugin-dir=/usr/lib/mysql/plugin —user=mysql —pid-file=alvm.pid —socket=/run/mysqld/mysqld.sock —port=3306
5532 root 0:00 grep 3306 - ls -l /var/lib/mysql/alvm.pid
-rw-rw—— 1 mysql mysql 5 Apr 28 13:28 /var/lib/mysql/alvm.pid
Init script reports daemon as ‘crashed’. For me it worked to add the line ‘pidfile=$(getconf pid-file “/run/mysqld/mysqld.pid”)’ before the first variable usage (in line ‘command_args=“—pid-file=$pidfile —syslog —nowatch”’).
—- mariadb.old
+ mariadb.new
@@ –7,6 +7,7 @@
retry=“60”
extra_stopped_commands=“setup”
+pidfile=$(getconf pid-file “/run/mysqld/mysqld.pid”)
command=“/usr/bin/mysqld_safe”
command_args=“—pid-file=$pidfile —syslog —nowatch”
@@ –22,7 +23,6 @@
}
start_pre() {
- pidfile=$(getconf pid-file “/run/mysqld/mysqld.pid”)
required_dirs=$(getconf datadir “/var/lib/mysql”)
if [ ! -d $required_dirs/mysql ]; then
eerror “Datadir ‘$required_dirs’ is empty or invalid.”
@@ –32,9 +32,5 @@
ewaitfile 10 $(getconf socket “/run/mysqld/mysqld.sock”)
-}
start_post() {-stop_pre() {
- pidfile=$(getconf pid-file “/run/mysqld/mysqld.pid”)
}
(from redmine: issue id 5506, created on 2016-04-28)