diff options
author | unknown <joerg@mysql.com> | 2006-06-20 22:40:46 +0200 |
---|---|---|
committer | unknown <joerg@mysql.com> | 2006-06-20 22:40:46 +0200 |
commit | 99740b3fb07780d1e6e04af4c56144ed3f363ebc (patch) | |
tree | b93f288d4f437afe5b3db9feb3a10a1fdee8bcbc /support-files/mysql.server.sh | |
parent | 0f6a24ad6c0c5caef0101c56ad1a6c2313d103d6 (diff) | |
download | mariadb-git-99740b3fb07780d1e6e04af4c56144ed3f363ebc.tar.gz |
Fix for bug#18516 (also #19353, reported for 5.1):
In addition to include "mysql_upgrade" in a RPM, it should also be called
when the RPM is upgraded.
support-files/mysql.server.sh:
Support getting additional arguments, which need to be passed on to the server.
This works only if the server is started through "mysqld_safe", as the IM will not pass such arguments.
So if the IM would be used, additional arguments cause the start to fail (voluntarily).
This feature is needed so that tools like RPM can start the server in an "isolated" way,
see the patch to the RPM spec file (also in this changeset) to call "mysql_upgrade".
support-files/mysql.spec.sh:
Call "mysql_upgrade" during an RPM upgrade.
"mysql_upgrade" needs a server to run, as it issues SQL commands.
(This had been neglected previously.)
It also needs to connect as "root", but in an RPM upgrade the password is unknown.
To allow this, the server is started "--skip-grant-tables".
Normally, this would open big security holes, so it is also started "--skip-networking",
and access to the socket is limited to "mysql" + "root" by temporarily setting mode 700.
Diffstat (limited to 'support-files/mysql.server.sh')
-rw-r--r-- | support-files/mysql.server.sh | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/support-files/mysql.server.sh b/support-files/mysql.server.sh index 27a1b85a354..d5041f30c0a 100644 --- a/support-files/mysql.server.sh +++ b/support-files/mysql.server.sh @@ -98,6 +98,11 @@ PATH=/sbin:/usr/sbin:/bin:/usr/bin:$basedir/bin export PATH mode=$1 # start or stop +shift +other_args="$*" # uncommon, but needed when called from an RPM upgrade action + # Expected: "--skip-networking --skip-grant-tables" + # They are not checked here, intentionally, as it is the resposibility + # of the "spec" file author to give correct arguments only. case `echo "testing\c"`,`echo -n testing` in *c*,-n*) echo_n= echo_c= ;; @@ -264,6 +269,11 @@ case "$mode" in echo $echo_n "Starting MySQL" if test -x $manager -a "$use_mysqld_safe" = "0" then + if test -n "$other_args" + then + log_failure_msg "MySQL manager does not support options '$other_args'" + exit 1 + fi # Give extra arguments to mysqld with the my.cnf file. This script may # be overwritten at next upgrade. $manager --user=$user --pid-file=$pid_file >/dev/null 2>&1 & @@ -279,7 +289,7 @@ case "$mode" in # Give extra arguments to mysqld with the my.cnf file. This script # may be overwritten at next upgrade. pid_file=$server_pid_file - $bindir/mysqld_safe --datadir=$datadir --pid-file=$server_pid_file >/dev/null 2>&1 & + $bindir/mysqld_safe --datadir=$datadir --pid-file=$server_pid_file $other_args >/dev/null 2>&1 & wait_for_pid created # Make lock for RedHat / SuSE @@ -327,8 +337,8 @@ case "$mode" in 'restart') # Stop the service and regardless of whether it was # running or not, start it again. - $0 stop - $0 start + $0 stop $other_args + $0 start $other_args ;; 'reload') @@ -343,7 +353,7 @@ case "$mode" in *) # usage - echo "Usage: $0 start|stop|restart|reload" + echo "Usage: $0 {start|stop|restart|reload} [ MySQL server options ]" exit 1 ;; esac |