summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rw-r--r--scripts/CMakeLists.txt7
-rw-r--r--scripts/mysql_config.sh15
-rw-r--r--scripts/mysql_system_tables_fix.sql23
-rw-r--r--[-rwxr-xr-x]scripts/mysqlaccess.conf0
-rw-r--r--scripts/mysqlaccess.sh12
-rw-r--r--scripts/mysqld_multi.sh10
-rw-r--r--scripts/mysqld_safe.sh29
-rw-r--r--scripts/mysqlhotcopy.sh3
-rw-r--r--scripts/mytop.sh28
9 files changed, 61 insertions, 66 deletions
diff --git a/scripts/CMakeLists.txt b/scripts/CMakeLists.txt
index e46da850157..c0fc67c0564 100644
--- a/scripts/CMakeLists.txt
+++ b/scripts/CMakeLists.txt
@@ -221,12 +221,17 @@ INSTALL_SCRIPT(
ENDIF()
SET(prefix "${CMAKE_INSTALL_PREFIX}")
-SET(sysconfdir ${prefix})
+IF(INSTALL_SYSCONFDIR)
+ SET(sysconfdir ${DEFAULT_SYSCONFDIR})
+ELSE()
+ SET(sysconfdir "/etc")
+ENDIF()
SET(bindir ${prefix}/${INSTALL_BINDIR})
SET(libexecdir ${prefix}/${INSTALL_SBINDIR})
SET(scriptdir ${prefix}/${INSTALL_BINDIR})
SET(datadir ${prefix}/${INSTALL_MYSQLSHAREDIR})
SET(pkgdatadir ${prefix}/${INSTALL_MYSQLSHAREDIR})
+SET(libsubdir ${INSTALL_LIBDIR})
SET(pkgincludedir ${prefix}/${INSTALL_INCLUDEDIR})
SET(pkglibdir ${prefix}/${INSTALL_LIBDIR})
SET(pkgplugindir ${prefix}/${INSTALL_PLUGINDIR})
diff --git a/scripts/mysql_config.sh b/scripts/mysql_config.sh
index de874ef0424..52f6d563fe5 100644
--- a/scripts/mysql_config.sh
+++ b/scripts/mysql_config.sh
@@ -76,7 +76,8 @@ get_full_path ()
me=`get_full_path $0`
-basedir=`echo $me | sed -e 's;/bin/mysql_config;;'`
+# Script might have been renamed but assume mysql_<something>config<something>
+basedir=`echo $me | sed -e 's;/bin/mysql_.*config.*;;'`
ldata='@localstatedir@'
execdir='@libexecdir@'
@@ -85,11 +86,11 @@ bindir='@bindir@'
# If installed, search for the compiled in directory first (might be "lib64")
pkglibdir='@pkglibdir@'
pkglibdir_rel=`echo $pkglibdir | sed -e "s;^$basedir/;;"`
-fix_path pkglibdir $pkglibdir_rel lib64/mysql lib64 lib/mysql lib
+fix_path pkglibdir $pkglibdir_rel @libsubdir@/mysql @libsubdir@
plugindir='@pkgplugindir@'
plugindir_rel=`echo $plugindir | sed -e "s;^$basedir/;;"`
-fix_path plugindir $plugindir_rel lib/mysql/plugin lib/plugin
+fix_path plugindir $plugindir_rel @libsubdir@/mysql/plugin @libsubdir@/plugin
pkgincludedir='@pkgincludedir@'
fix_path pkgincludedir include/mysql
@@ -131,10 +132,10 @@ Options:
pkglibdir [$pkglibdir]
plugindir [$plugindir]
EOF
- exit 0
+ exit $1
}
-if test $# -le 0; then usage; fi
+if test $# -le 0; then usage 0 ; fi
while test $# -gt 0; do
case $1 in
@@ -153,10 +154,10 @@ while test $# -gt 0; do
pkgincludedir) echo "$pkgincludedir" ;;
pkglibdir) echo "$pkglibdir" ;;
plugindir) echo "$plugindir" ;;
- *) usage ;;
+ *) usage 1 >&2 ;;
esac
;;
- *) usage ;;
+ *) usage 1 >&2 ;;
esac
shift
diff --git a/scripts/mysql_system_tables_fix.sql b/scripts/mysql_system_tables_fix.sql
index 96e4103b5bd..a7837b40e99 100644
--- a/scripts/mysql_system_tables_fix.sql
+++ b/scripts/mysql_system_tables_fix.sql
@@ -650,6 +650,22 @@ DROP TABLE tmp_proxies_priv;
# Convering the host name to lower case for existing users
UPDATE user SET host=LOWER( host ) WHERE LOWER( host ) <> host;
+# update timestamp fields in the innodb stat tables
+set @str="alter table mysql.innodb_index_stats modify last_update timestamp not null default current_timestamp on update current_timestamp";
+set @str=if(@have_innodb <> 0, @str, "set @dummy = 0");
+prepare stmt from @str;
+execute stmt;
+
+set @str=replace(@str, "innodb_index_stats", "innodb_table_stats");
+prepare stmt from @str;
+execute stmt;
+
+SET @innodb_index_stats_fk= (select count(*) from information_schema.referential_constraints where constraint_schema='mysql' and table_name = 'innodb_index_stats' and referenced_table_name = 'innodb_table_stats' and constraint_name = 'innodb_index_stats_ibfk_1');
+SET @str=IF(@innodb_index_stats_fk > 0 and @have_innodb > 0, "ALTER TABLE mysql.innodb_index_stats DROP FOREIGN KEY `innodb_index_stats_ibfk_1`", "SET @dummy = 0");
+PREPARE stmt FROM @str;
+EXECUTE stmt;
+DROP PREPARE stmt;
+
# MDEV-4332 longer user names
alter table user modify User char(80) binary not null default '';
alter table db modify User char(80) binary not null default '';
@@ -669,12 +685,5 @@ alter table tables_priv modify Grantor char(141) COLLATE utf8_bin not null
# This should not be needed, but gives us some extra testing that the above
# changes was correct
-set @have_innodb= (select count(engine) from information_schema.engines where engine='INNODB' and support != 'NO');
-SET @innodb_index_stats_fk= (select count(*) from information_schema.referential_constraints where constraint_schema='mysql' and table_name = 'innodb_index_stats' and referenced_table_name = 'innodb_table_stats' and constraint_name = 'innodb_index_stats_ibfk_1');
-SET @str=IF(@innodb_index_stats_fk > 0 and @have_innodb > 0, "ALTER TABLE mysql.innodb_index_stats DROP FOREIGN KEY `innodb_index_stats_ibfk_1`", "SET @dummy = 0");
-PREPARE stmt FROM @str;
-EXECUTE stmt;
-DROP PREPARE stmt;
-
flush privileges;
diff --git a/scripts/mysqlaccess.conf b/scripts/mysqlaccess.conf
index faf47da5f6c..faf47da5f6c 100755..100644
--- a/scripts/mysqlaccess.conf
+++ b/scripts/mysqlaccess.conf
diff --git a/scripts/mysqlaccess.sh b/scripts/mysqlaccess.sh
index f422b6a7dc8..6fc090ab972 100644
--- a/scripts/mysqlaccess.sh
+++ b/scripts/mysqlaccess.sh
@@ -261,12 +261,12 @@ Release Notes:
* log-file for debug-output : /tmp/mysqlaccess.log
* default values are read from a configuration file $script.conf
first this file is looked for in the current directory; if not
- found it is looked for in /etc/
+ found it is looked for in @sysconfdir@
Note that when default-values are given, these can't get overriden
by empty (blanc) values!
* CGI-BIN version with HTML and forms interface. Simply place the
script in an ScriptAliased directory, make the configuration file
- available in the that directory or in /etc, and point your browser
+ available in the that directory or in @sysconfdir@, and point your browser
to the right URL.
* copy the grant-rules to temporary tables, where you are safe to
play with them.
@@ -480,12 +480,12 @@ MySQLaccess::Report::Print_Header();
if (-f "./$script_conf") {
require "./$script_conf";
}
+ elsif (-f "@prefix@/$script_conf") {
+ require "@prefix@/$script_conf";
+ }
elsif (-f "@sysconfdir@/$script_conf") {
require "@sysconfdir@/$script_conf";
}
- elsif (-f "/etc/$script_conf") {
- require "/etc/$script_conf";
- }
# ****************************
# Read in all parameters
@@ -950,8 +950,8 @@ sub MergeConfigFile {
# =================================
sub MergeConfigFiles {
my ($name,$pass,$uid,$gid,$quota,$comment,$gcos,$dir,$shell) = getpwuid $<;
+ MergeConfigFile("@prefix@/my.cnf");
MergeConfigFile("@sysconfdir@/my.cnf");
- MergeConfigFile("/etc/my.cnf");
MergeConfigFile("$dir/.my.cnf");
}
diff --git a/scripts/mysqld_multi.sh b/scripts/mysqld_multi.sh
index 4dd5eae003d..e3f8e50122c 100644
--- a/scripts/mysqld_multi.sh
+++ b/scripts/mysqld_multi.sh
@@ -503,9 +503,9 @@ sub list_defaults_files
my %seen; # Don't list the same file more than once
return grep { defined $_ and not $seen{$_}++ and -f $_ and -r $_ }
- ('/etc/my.cnf',
- '/etc/mysql/my.cnf',
- '@sysconfdir@/my.cnf',
+ ('@sysconfdir@/my.cnf',
+ '@sysconfdir@/mysql/my.cnf',
+ '@prefix@/my.cnf',
($ENV{MYSQL_HOME} ? "$ENV{MYSQL_HOME}/my.cnf" : undef),
$opt{'extra-file'},
($ENV{HOME} ? "$ENV{HOME}/.my.cnf" : undef));
@@ -636,7 +636,7 @@ sub example
{
print <<EOF;
# This is an example of a my.cnf file for $my_progname.
-# Usually this file is located in home dir ~/.my.cnf or /etc/my.cnf
+# Usually this file is located in home dir ~/.my.cnf or @sysconfdir@/my.cnf
#
# SOME IMPORTANT NOTES FOLLOW:
#
@@ -709,7 +709,7 @@ sub example
# (as per Linux/Unix standard). You may even replace the
# /etc/init.d/mysql.server script with it.
#
-# Before using, you must create a my.cnf file either in @sysconfdir@/my.cnf
+# Before using, you must create a my.cnf file either in @prefix@/my.cnf
# or /root/.my.cnf and add the [mysqld_multi] and [mysqld#] groups.
#
# The script can be found from support-files/mysqld_multi.server.sh
diff --git a/scripts/mysqld_safe.sh b/scripts/mysqld_safe.sh
index 4e7b098c8d8..f91d936c315 100644
--- a/scripts/mysqld_safe.sh
+++ b/scripts/mysqld_safe.sh
@@ -273,16 +273,6 @@ wsrep_recover_position() {
}
parse_arguments() {
- # We only need to pass arguments through to the server if we don't
- # handle them here. So, we collect unrecognized options (passed on
- # the command line) into the args variable.
- pick_args=
- if test "$1" = PICK-ARGS-FROM-ARGV
- then
- pick_args=1
- shift
- fi
-
for arg do
val=`echo "$arg" | sed -e "s;--[^=]*=;;"`
case "$arg" in
@@ -340,11 +330,10 @@ parse_arguments() {
--help) usage ;;
*)
- if test -n "$pick_args"
- then
- append_arg_to_args "$arg"
- fi
- ;;
+ case "$unrecognized_handling" in
+ collect) append_arg_to_args "$arg" ;;
+ complain) log_error "unknown option '$arg'" ;;
+ esac
esac
done
}
@@ -601,8 +590,16 @@ then
SET_USER=0
fi
+# If arguments come from [mysqld_safe] section of my.cnf
+# we complain about unrecognized options
+unrecognized_handling=complain
parse_arguments `$print_defaults $defaults --loose-verbose mysqld_safe safe_mysqld mariadb_safe`
-parse_arguments PICK-ARGS-FROM-ARGV "$@"
+
+# We only need to pass arguments through to the server if we don't
+# handle them here. So, we collect unrecognized options (passed on
+# the command line) into the args variable.
+unrecognized_handling=collect
+parse_arguments "$@"
#
diff --git a/scripts/mysqlhotcopy.sh b/scripts/mysqlhotcopy.sh
index 1ef743725e5..b6ff7e1b28d 100644
--- a/scripts/mysqlhotcopy.sh
+++ b/scripts/mysqlhotcopy.sh
@@ -56,6 +56,9 @@ WARNING: THIS PROGRAM IS STILL IN BETA. Comments/patches welcome.
# Documentation continued at end of file
+# fix CORE::GLOBAL::die to return a predictable exit code
+BEGIN { *CORE::GLOBAL::die= sub { warn @_; exit 1; }; }
+
my $VERSION = "1.23";
my $opt_tmpdir = $ENV{TMPDIR} || "/tmp";
diff --git a/scripts/mytop.sh b/scripts/mytop.sh
index fe7765988fb..17a87e9efd2 100644
--- a/scripts/mytop.sh
+++ b/scripts/mytop.sh
@@ -70,7 +70,6 @@ sub GetShowStatus();
sub cmd_s;
sub cmd_S;
sub cmd_q;
-sub FindProg($);
## Default Config Values
@@ -1366,9 +1365,9 @@ sub GetInnoDBStatus()
{
if (not $config{pager})
{
- if (not $config{pager} = FindProg('less'))
+ if (not $config{pager} = my_which('less'))
{
- $config{pager} = FindProg('more');
+ $config{pager} = my_which('more');
}
}
@@ -1467,9 +1466,9 @@ sub GetShowVariables()
{
if (not $config{pager})
{
- if (not $config{pager} = FindProg('less'))
+ if (not $config{pager} = my_which('less'))
{
- $config{pager} = FindProg('more');
+ $config{pager} = my_which('more');
}
}
@@ -1825,25 +1824,6 @@ sub Execute($)
return $sth;
}
-sub FindProg($)
-{
- my $prog = shift;
- my $found = undef;
- my @search_dirs = ("/bin", "/usr/bin", "/usr/sbin",
- "/usr/local/bin", "/usr/local/sbin");
-
- for (@search_dirs)
- {
- my $loc = "$_/$prog";
- if (-e $loc)
- {
- $found = $loc;
- last;
- }
- }
- return $found;
-}
-
####
#### my_which is used, because we can't assume that every system has the
#### which -command. my_which can take only one argument at a time.