Bug #71611 /etc/init.d/mysql needs to be modified to support chroot= in /etc/my.cnf
| Submitted: | 6 Feb 2014 18:47 | Modified: | 6 Feb 2014 19:57 |
|---|---|---|---|
| Reporter: | Pura Vida | Email Updates: | |
| Status: | Verified | Impact on me: | |
| Category: | MySQL Server: Installing | Severity: | S3 (Non-critical) |
| Version: | 5.6-16 | OS: | Linux |
| Assigned to: | CPU Architecture: | Any | |
| Tags: | chroot, Contribution, MySQL, script, start, stop | ||
[6 Feb 2014 18:47]
Pura Vida
[6 Feb 2014 19:07]
Pura Vida
# diff -u mysql mysql_chroot
--- mysql 2014-01-14 10:58:00.000000000 -0500
+++ mysql_chroot 2014-02-06 13:04:51.822824055 -0500
@@ -61,6 +61,7 @@
# Set some defaults
mysqld_pid_file_path=
+chroot=
if test -z "$basedir"
then
basedir=/usr
@@ -137,6 +138,7 @@
;;
--pid-file=*) mysqld_pid_file_path=`echo "$arg" | sed -e 's/^[^=]*=//'` ;;
--service-startup-timeout=*) service_startup_timeout=`echo "$arg" | sed -e 's/^[^=]*=//'` ;;
+ --chroot=*) chroot=`echo "$arg" | sed -e 's/^[^=]*=//'` ;;
esac
done
}
@@ -258,7 +260,7 @@
#
# Set pid file if not given
#
-if test -z "$mysqld_pid_file_path"
+if test -z "$chroot$mysqld_pid_file_path"
then
mysqld_pid_file_path=$datadir/`hostname`.pid
else
@@ -281,7 +283,7 @@
# Give extra arguments to mysqld with the my.cnf file. This script
# may be overwritten at next upgrade.
$bindir/mysqld_safe --datadir="$datadir" --pid-file="$mysqld_pid_file_path" $other_args >/dev/null 2>&1 &
- wait_for_pid created "$!" "$mysqld_pid_file_path"; return_value=$?
+ wait_for_pid created "$!" "$chroot$mysqld_pid_file_path"; return_value=$?
# Make lock for RedHat / SuSE
if test -w "$lockdir"
@@ -299,19 +301,19 @@
# Stop daemon. We use a signal here to avoid having to know the
# root password.
- if test -s "$mysqld_pid_file_path"
+ if test -s "$chroot$mysqld_pid_file_path"
then
- mysqld_pid=`cat "$mysqld_pid_file_path"`
+ mysqld_pid=`cat "$chroot$mysqld_pid_file_path"`
if (kill -0 $mysqld_pid 2>/dev/null)
then
echo $echo_n "Shutting down MySQL"
kill $mysqld_pid
# mysqld should remove the pid file when it exits, so wait for it.
- wait_for_pid removed "$mysqld_pid" "$mysqld_pid_file_path"; return_value=$?
+ wait_for_pid removed "$mysqld_pid" "$chroot$mysqld_pid_file_path"; return_value=$?
else
log_failure_msg "MySQL server process #$mysqld_pid is not running!"
- rm "$mysqld_pid_file_path"
+ rm "$chroot$mysqld_pid_file_path"
fi
# Delete lock for RedHat / SuSE
@@ -337,10 +339,10 @@
;;
'reload'|'force-reload')
- if test -s "$mysqld_pid_file_path" ; then
- read mysqld_pid < "$mysqld_pid_file_path"
+ if test -s "$chroot$mysqld_pid_file_path" ; then
+ read mysqld_pid < "$chroot$mysqld_pid_file_path"
kill -HUP $mysqld_pid && log_success_msg "Reloading service MySQL"
- touch "$mysqld_pid_file_path"
+ touch "$chroot$mysqld_pid_file_path"
else
log_failure_msg "MySQL PID file could not be found!"
exit 1
@@ -348,8 +350,8 @@
;;
'status')
# First, check to see if pid file exists
- if test -s "$mysqld_pid_file_path" ; then
- read mysqld_pid < "$mysqld_pid_file_path"
+ if test -s "$chroot$mysqld_pid_file_path" ; then
+ read mysqld_pid < "$chroot$mysqld_pid_file_path"
if kill -0 $mysqld_pid 2>/dev/null ; then
log_success_msg "MySQL running ($mysqld_pid)"
exit 0
[6 Feb 2014 19:11]
Pura Vida
The relevant parameters. [mysqld] chroot = /var/log/mysql datadir = /var/lib/mysql/ log-bin = /var/lib/mysql/mysqld-bin pid-file = /var/run/mysqld/mysqld.pid slow-query-log-file = /var/lib/mysql/mysql-slow.log socket = /var/lib/mysql/mysql.sock log-error = /var/log/mysqld.log [client] socket = /var/log/mysql/var/lib/mysql/mysql.sock
[6 Feb 2014 19:13]
Pura Vida
The relevant parameters. [mysqld] chroot = /chroot datadir = /var/lib/mysql/ log-bin = /var/lib/mysql/mysqld-bin pid-file = /var/run/mysqld/mysqld.pid slow-query-log-file = /var/lib/mysql/mysql-slow.log socket = /var/lib/mysql/mysql.sock log-error = /var/log/mysqld.log [client] socket = /chroot/var/lib/mysql/mysql.sock
[6 Feb 2014 19:57]
Sveta Smirnova
Thank you for the report. Verified as described: pid file created, but mysql.server script expects it in another place.
[6 Feb 2014 19:59]
Sveta Smirnova
Server actually starts, simply mysql.server can not finish execution.
[6 Feb 2014 20:00]
Sveta Smirnova
In order for us to accept your contribution please sign Oracle Contributor Agreement (OCA) as described in "Contributions" tab.
Portions of this website are copyright © 2001, 2002 The PHP Group
Page generated in 0.049 sec. using MySQL 8.4.7-u6-cloud
Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the
respective copyright holders.
It is not reviewed in advance
by Oracle and does not necessarily represent the opinion of
Oracle or any other party.