summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/CMakeLists.txt9
-rw-r--r--scripts/Makefile.am26
-rw-r--r--scripts/make_binary_distribution.sh468
-rwxr-xr-xscripts/make_win_bin_dist36
-rw-r--r--scripts/make_win_src_distribution_old.sh560
-rw-r--r--scripts/mysql_config.pl.in2
-rw-r--r--scripts/mysql_config.sh6
-rw-r--r--scripts/mysql_convert_table_format.sh81
-rw-r--r--scripts/mysql_explain_log.sh414
-rw-r--r--scripts/mysql_install_db.sh345
-rw-r--r--scripts/mysql_prepare_privilege_tables_for_5.sql53
-rw-r--r--scripts/mysql_setpermission.sh2
-rw-r--r--scripts/mysql_system_tables.sql38
-rw-r--r--scripts/mysql_system_tables_data.sql11
-rw-r--r--scripts/mysql_system_tables_fix.sql161
-rw-r--r--scripts/mysql_tableinfo.sh494
-rw-r--r--scripts/mysql_upgrade_shell.sh215
-rw-r--r--scripts/mysql_zap.sh4
-rw-r--r--scripts/mysqld_multi.sh10
-rw-r--r--scripts/mysqld_safe-watch.sh150
-rw-r--r--scripts/mysqld_safe.sh422
-rw-r--r--scripts/mysqldumpslow.sh13
22 files changed, 1039 insertions, 2481 deletions
diff --git a/scripts/CMakeLists.txt b/scripts/CMakeLists.txt
index 8aca7792e7c..f0db25be79a 100755
--- a/scripts/CMakeLists.txt
+++ b/scripts/CMakeLists.txt
@@ -61,21 +61,12 @@ CONFIGURE_FILE(mysql_config.pl.in
CONFIGURE_FILE(mysql_convert_table_format.sh
scripts/mysql_convert_table_format.pl ESCAPE_QUOTES @ONLY)
-CONFIGURE_FILE(mysql_explain_log.sh
- scripts/mysql_explain_log.pl ESCAPE_QUOTES @ONLY)
-
CONFIGURE_FILE(mysql_install_db.pl.in
scripts/mysql_install_db.pl ESCAPE_QUOTES @ONLY)
CONFIGURE_FILE(mysql_secure_installation.pl.in
scripts/mysql_secure_installation.pl ESCAPE_QUOTES @ONLY)
-CONFIGURE_FILE(mysql_tableinfo.sh
- scripts/mysql_tableinfo.pl ESCAPE_QUOTES @ONLY)
-
-CONFIGURE_FILE(mysql_upgrade_shell.sh
- scripts/mysql_upgrade_shell.pl ESCAPE_QUOTES @ONLY)
-
CONFIGURE_FILE(mysqld_multi.sh
scripts/mysqld_multi.pl ESCAPE_QUOTES @ONLY)
diff --git a/scripts/Makefile.am b/scripts/Makefile.am
index 87170b46675..0292617c7a5 100644
--- a/scripts/Makefile.am
+++ b/scripts/Makefile.am
@@ -34,18 +34,13 @@ bin_SCRIPTS = @server_scripts@ \
mysql_find_rows \
mysqlhotcopy \
mysqldumpslow \
- mysql_explain_log \
- mysql_tableinfo \
- mysql_upgrade_shell \
mysqld_multi
noinst_SCRIPTS = make_binary_distribution \
- make_sharedlib_distribution \
- make_win_src_distribution_old
+ make_sharedlib_distribution
EXTRA_SCRIPTS = make_binary_distribution.sh \
make_sharedlib_distribution.sh \
- make_win_src_distribution_old.sh \
msql2mysql.sh \
mysql_config.sh \
mysql_config.pl.in \
@@ -63,10 +58,7 @@ EXTRA_SCRIPTS = make_binary_distribution.sh \
mysql_find_rows.sh \
mysqlhotcopy.sh \
mysqldumpslow.sh \
- mysql_explain_log.sh \
mysqld_multi.sh \
- mysql_tableinfo.sh \
- mysql_upgrade_shell.sh \
mysqld_safe.sh
EXTRA_DIST = $(EXTRA_SCRIPTS) \
@@ -98,11 +90,12 @@ CLEANFILES = @server_scripts@ \
mysql_find_rows \
mysqlhotcopy \
mysqldumpslow \
- mysql_explain_log \
- mysql_tableinfo \
- mysql_upgrade_shell \
- mysqld_multi \
- make_win_src_distribution_old
+ mysqld_multi
+
+pkgplugindir = $(pkglibdir)/plugin
+
+# Default same as 'pkgdatadir', but we can override it
+pkgsuppdir = $(datadir)/@PACKAGE@
# mysqlbug should be distributed built so that people can report build
# failures with it.
@@ -148,7 +141,11 @@ SUFFIXES = .sh
-e 's!@''pkglibdir''@!$(pkglibdir)!g' \
-e 's!@''pkgincludedir''@!$(pkgincludedir)!g' \
-e 's!@''pkgdatadir''@!$(pkgdatadir)!g' \
+ -e 's!@''pkgplugindir''@!$(pkgplugindir)!g' \
+ -e 's!@''pkgsuppdir''@!$(pkgsuppdir)!g' \
-e 's!@''sysconfdir''@!$(sysconfdir)!g' \
+ -e 's!@''mandir''@!$(mandir)!g' \
+ -e 's!@''infodir''@!$(infodir)!g' \
-e 's!@''CC''@!@CC@!'\
-e 's!@''CXX''@!@CXX@!'\
-e 's!@''GXX''@!@GXX@!'\
@@ -165,6 +162,7 @@ SUFFIXES = .sh
-e 's!@''CFLAGS''@!@CFLAGS@!'\
-e 's!@''CXXFLAGS''@!@CXXFLAGS@!'\
-e 's!@''LDFLAGS''@!@LDFLAGS@!'\
+ -e 's!@''LIBDL''@!@LIBDL@!'\
-e 's!@''CLIENT_LIBS''@!@CLIENT_LIBS@!' \
-e 's!@''ZLIB_LIBS''@!@ZLIB_LIBS@!' \
-e 's!@''LIBS''@!@LIBS@!' \
diff --git a/scripts/make_binary_distribution.sh b/scripts/make_binary_distribution.sh
index f156ea3b986..152225f86b1 100644
--- a/scripts/make_binary_distribution.sh
+++ b/scripts/make_binary_distribution.sh
@@ -14,36 +14,64 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-# This is a script to create a TAR or ZIP binary distribution out of a
-# built source tree. The output file will be put at the top level of
-# the source tree, as "mysql-<vsn>....{tar.gz,zip}"
+##############################################################################
#
-# The temporary directory path given to "--tmp=<path>" has to be
-# absolute and with no spaces.
+# This is a script to create a TAR or ZIP binary distribution out of a
+# built source tree. The output file will be put at the top level of
+# the source tree, as "mysql-<vsn>....{tar.gz,zip}"
+#
+# Note that the structure created by this script is slightly different from
+# what a normal "make install" would produce. No extra "mysql" sub directory
+# will be created, i.e. no "$prefix/include/mysql", "$prefix/lib/mysql" or
+# "$prefix/share/mysql". This is because the build system explicitly calls
+# make with pkgdatadir=<datadir>, etc.
+#
+# In GNU make/automake terms
+#
+# "pkglibdir" is set to the same as "libdir"
+# "pkgincludedir" is set to the same as "includedir"
+# "pkgdatadir" is set to the same as "datadir"
+# "pkgplugindir" is set to "$pkglibdir/plugin"
+# "pkgsuppdir" is set to "@prefix@/support-files",
+# normally the same as "datadir"
+#
+# The temporary directory path given to "--tmp=<path>" has to be
+# absolute and with no spaces.
+#
+# Note that for best result, the original "make" should be done with
+# the same arguments as used for "make install" below, especially the
+# 'pkglibdir', as the RPATH should to be set correctly.
+#
+##############################################################################
+
+##############################################################################
+#
+# Read the command line arguments that control this script
+#
+##############################################################################
machine=@MACHINE_TYPE@
system=@SYSTEM_TYPE@
-version=@VERSION@
SOURCE=`pwd`
CP="cp -p"
MV="mv"
-STRIP=1
-DEBUG=0
+STRIP=1 # Option ignored
SILENT=0
-MACHINE=""
PLATFORM=""
TMP=/tmp
+NEW_NAME="" # Final top directory and TAR package name
SUFFIX=""
-NDBCLUSTER=""
+SHORT_PRODUCT_TAG="" # If don't want server suffix in package name
+NDBCLUSTER="" # Option ignored
for arg do
case "$arg" in
- --debug) DEBUG=1;;
--tmp=*) TMP=`echo "$arg" | sed -e "s;--tmp=;;"` ;;
--suffix=*) SUFFIX=`echo "$arg" | sed -e "s;--suffix=;;"` ;;
+ --short-product-tag=*) SHORT_PRODUCT_TAG=`echo "$arg" | sed -e "s;--short-product-tag=;;"` ;;
--no-strip) STRIP=0 ;;
- --machine=*) MACHINE=`echo "$arg" | sed -e "s;--machine=;;"` ;;
+ --machine=*) machine=`echo "$arg" | sed -e "s;--machine=;;"` ;;
--platform=*) PLATFORM=`echo "$arg" | sed -e "s;--platform=;;"` ;;
--silent) SILENT=1 ;;
--with-ndbcluster) NDBCLUSTER=1 ;;
@@ -54,54 +82,62 @@ for arg do
esac
done
-# Remove vendor from $system
-system=`echo $system | sed -e 's/[a-z]*-\(.*\)/\1/g'`
-
-# Map OS names to "our" OS names (eg. darwin6.8 -> osx10.2)
-system=`echo $system | sed -e 's/darwin6.*/osx10.2/g'`
-system=`echo $system | sed -e 's/darwin7.*/osx10.3/g'`
-system=`echo $system | sed -e 's/darwin8.*/osx10.4/g'`
-system=`echo $system | sed -e 's/darwin9.*/osx10.5/g'`
-system=`echo $system | sed -e 's/\(aix4.3\).*/\1/g'`
-system=`echo $system | sed -e 's/\(aix5.1\).*/\1/g'`
-system=`echo $system | sed -e 's/\(aix5.2\).*/\1/g'`
-system=`echo $system | sed -e 's/\(aix5.3\).*/\1/g'`
-system=`echo $system | sed -e 's/osf5.1b/tru64/g'`
-system=`echo $system | sed -e 's/linux-gnu/linux/g'`
-system=`echo $system | sed -e 's/solaris2.\([0-9]*\)/solaris\1/g'`
-system=`echo $system | sed -e 's/sco3.2v\(.*\)/openserver\1/g'`
-
-if [ x"$MACHINE" != x"" ] ; then
- machine=$MACHINE
+# ----------------------------------------------------------------------
+# Adjust "system" output from "uname" to be more human readable
+# ----------------------------------------------------------------------
+
+if [ x"$PLATFORM" = x"" ] ; then
+ # FIXME move this to the build tools
+ # Remove vendor from $system
+ system=`echo $system | sed -e 's/[a-z]*-\(.*\)/\1/g'`
+
+ # Map OS names to "our" OS names (eg. darwin6.8 -> osx10.2)
+ system=`echo $system | sed -e 's/darwin6.*/osx10.2/g'`
+ system=`echo $system | sed -e 's/darwin7.*/osx10.3/g'`
+ system=`echo $system | sed -e 's/darwin8.*/osx10.4/g'`
+ system=`echo $system | sed -e 's/darwin9.*/osx10.5/g'`
+ system=`echo $system | sed -e 's/\(aix4.3\).*/\1/g'`
+ system=`echo $system | sed -e 's/\(aix5.1\).*/\1/g'`
+ system=`echo $system | sed -e 's/\(aix5.2\).*/\1/g'`
+ system=`echo $system | sed -e 's/\(aix5.3\).*/\1/g'`
+ system=`echo $system | sed -e 's/osf5.1b/tru64/g'`
+ system=`echo $system | sed -e 's/linux-gnu/linux/g'`
+ system=`echo $system | sed -e 's/solaris2.\([0-9]*\)/solaris\1/g'`
+ system=`echo $system | sed -e 's/sco3.2v\(.*\)/openserver\1/g'`
+
+ PLATFORM="$system-$machine"
fi
-if [ x"$PLATFORM" != x"" ] ; then
- platform="$PLATFORM"
+# Print the platform name for build logs
+echo "PLATFORM NAME: $PLATFORM"
+
+case $PLATFORM in
+ *netware*) BASE_SYSTEM="netware" ;;
+esac
+
+# Change the distribution to a long descriptive name
+# For the cluster product, concentrate on the second part
+VERSION_NAME=@VERSION@
+case $VERSION_NAME in
+ *-ndb-* ) VERSION_NAME=`echo $VERSION_NAME | sed -e 's/[.0-9]*-ndb-//'` ;;
+esac
+if [ x"$SHORT_PRODUCT_TAG" != x"" ] ; then
+ NEW_NAME=mysql-$SHORT_PRODUCT_TAG-$VERSION_NAME-$PLATFORM$SUFFIX
else
- platform="$system-$machine"
+ NEW_NAME=mysql@MYSQL_SERVER_SUFFIX@-$VERSION_NAME-$PLATFORM$SUFFIX
fi
-# FIXME This should really be integrated with automake and not duplicate the
-# installation list.
-
+# ----------------------------------------------------------------------
+# Define BASE, and remove the old BASE directory if any
+# ----------------------------------------------------------------------
BASE=$TMP/my_dist$SUFFIX
-
if [ -d $BASE ] ; then
rm -rf $BASE
fi
-BS=""
-BIN_FILES=""
-BASE_SYSTEM="any"
-MYSQL_SHARE=$BASE/share/mysql
-
-case $system in
- *netware*)
- BASE_SYSTEM="netware"
- BS=".nlm"
- MYSQL_SHARE=$BASE/share
- ;;
-esac
+# ----------------------------------------------------------------------
+# Find the TAR to use
+# ----------------------------------------------------------------------
# This is needed to prefer GNU tar over platform tar because that can't
# always handle long filenames
@@ -128,24 +164,149 @@ which_1 ()
}
tar=`which_1 gnutar gtar`
-if [ "$?" = "1" -o x"$tar" = x"" ] ; then
+if [ $? -ne 0 -o x"$tar" = x"" ] ; then
tar=tar
fi
+##############################################################################
+#
+# Handle the Unix/Linux packaging using "make install"
+#
+##############################################################################
+
+if [ x"$BASE_SYSTEM" != x"netware" ] ; then
+
+ # ----------------------------------------------------------------------
+ # Terminate on any base level error
+ # ----------------------------------------------------------------------
+ set -e
+
+ # ----------------------------------------------------------------------
+ # Really ugly, one script, "mysql_install_db", needs prefix set to ".",
+ # i.e. makes access relative the current directory. This matches
+ # the documentation, so better not change this. And for another script,
+ # "mysql.server", we make some relative, others not.
+ # ----------------------------------------------------------------------
+
+ cd scripts
+ rm -f mysql_install_db
+ @MAKE@ mysql_install_db \
+ prefix=. \
+ bindir=./bin \
+ sbindir=./bin \
+ scriptdir=./bin \
+ libexecdir=./bin \
+ pkgdatadir=./share \
+ localstatedir=./data
+ cd ..
+
+ cd support-files
+ rm -f mysql.server
+ @MAKE@ mysql.server \
+ bindir=./bin \
+ sbindir=./bin \
+ scriptdir=./bin \
+ libexecdir=./bin \
+ pkgdatadir=@pkgdatadir@
+ cd ..
+
+ # ----------------------------------------------------------------------
+ # Do a install that we later are to pack. Use the same paths as in
+ # the build for the relevant directories.
+ # ----------------------------------------------------------------------
+ @MAKE@ DESTDIR=$BASE install \
+ pkglibdir=@pkglibdir@ \
+ pkgincludedir=@pkgincludedir@ \
+ pkgdatadir=@pkgdatadir@ \
+ pkgplugindir=@pkgplugindir@ \
+ pkgsuppdir=@pkgsuppdir@ \
+ mandir=@mandir@ \
+ infodir=@infodir@
+
+ # ----------------------------------------------------------------------
+ # Rename top directory, and set DEST to the new directory
+ # ----------------------------------------------------------------------
+ mv $BASE@prefix@ $BASE/$NEW_NAME
+ DEST=$BASE/$NEW_NAME
+
+ # ----------------------------------------------------------------------
+ # If we compiled with gcc, copy libgcc.a to the dist as libmygcc.a
+ # ----------------------------------------------------------------------
+ if [ x"@GXX@" = x"yes" ] ; then
+ gcclib=`@CC@ @CFLAGS@ --print-libgcc-file 2>/dev/null` || true
+ if [ -z "$gcclib" ] ; then
+ echo "Warning: Compiler doesn't tell libgcc.a!"
+ elif [ -f "$gcclib" ] ; then
+ $CP $gcclib $DEST/lib/libmygcc.a
+ else
+ echo "Warning: Compiler result '$gcclib' not found / no file!"
+ fi
+ fi
+
+ # FIXME let this script be in "bin/", where it is in the RPMs?
+ # http://dev.mysql.com/doc/refman/5.1/en/mysql-install-db-problems.html
+ mkdir $DEST/scripts
+ mv $DEST/bin/mysql_install_db $DEST/scripts/
+
+ # Note, no legacy "safe_mysqld" link to "mysqld_safe" in 5.1
+
+ # Copy readme and license files
+ cp README Docs/INSTALL-BINARY $DEST/
+ if [ -f COPYING -a -f EXCEPTIONS-CLIENT ] ; then
+ cp COPYING EXCEPTIONS-CLIENT $DEST/
+ elif [ -f LICENSE.mysql ] ; then
+ cp LICENSE.mysql $DEST/
+ else
+ echo "ERROR: no license files found"
+ exit 1
+ fi
+
+ # FIXME should be handled by make file, and to other dir
+ mkdir -p $DEST/bin $DEST/support-files
+ cp scripts/mysqlaccess.conf $DEST/bin/
+ cp support-files/magic $DEST/support-files/
+
+ # Create empty data directories, set permission (FIXME why?)
+ mkdir $DEST/data $DEST/data/mysql $DEST/data/test
+ chmod o-rwx $DEST/data $DEST/data/mysql $DEST/data/test
+
+ # ----------------------------------------------------------------------
+ # Create the result tar file
+ # ----------------------------------------------------------------------
+
+ echo "Using $tar to create archive"
+ OPT=cvf
+ if [ x$SILENT = x1 ] ; then
+ OPT=cf
+ fi
+
+ echo "Creating and compressing archive"
+ rm -f $NEW_NAME.tar.gz
+ (cd $BASE ; $tar $OPT - $NEW_NAME) | gzip -9 > $NEW_NAME.tar.gz
+ echo "$NEW_NAME.tar.gz created"
+
+ echo "Removing temporary directory"
+ rm -rf $BASE
+ exit 0
+fi
+
+
+##############################################################################
+#
+# Handle the Netware case, until integrated above
+#
+##############################################################################
+
+BS=".nlm"
+MYSQL_SHARE=$BASE/share
+
mkdir $BASE $BASE/bin $BASE/docs \
$BASE/include $BASE/lib $BASE/support-files $BASE/share $BASE/scripts \
$BASE/mysql-test $BASE/mysql-test/t $BASE/mysql-test/r \
$BASE/mysql-test/include $BASE/mysql-test/std_data $BASE/mysql-test/lib \
$BASE/mysql-test/suite
-if [ $BASE_SYSTEM != "netware" ] ; then
- mkdir $BASE/share/mysql $BASE/tests $BASE/sql-bench $BASE/man \
- $BASE/man/man1 $BASE/man/man8 $BASE/data $BASE/data/mysql $BASE/data/test
-
- chmod o-rwx $BASE/data $BASE/data/*
-fi
-
# Copy files if they exists, warn for those that don't.
# Note that when listing files to copy, we might list the file name
# twice, once in the directory location where it is built, and a
@@ -177,12 +338,13 @@ copyfileto $BASE COPYING COPYING.LIB README Docs/INSTALL-BINARY \
BIN_FILES="extra/comp_err$BS extra/replace$BS extra/perror$BS \
extra/resolveip$BS extra/my_print_defaults$BS \
extra/resolve_stack_dump$BS extra/mysql_waitpid$BS \
- myisam/myisamchk$BS myisam/myisampack$BS myisam/myisamlog$BS \
- myisam/myisam_ftdump$BS \
+ storage/myisam/myisamchk$BS storage/myisam/myisampack$BS \
+ storage/myisam/myisamlog$BS storage/myisam/myisam_ftdump$BS \
sql/mysqld$BS sql/mysqld-debug$BS \
sql/mysql_tzinfo_to_sql$BS \
server-tools/instance-manager/mysqlmanager$BS \
client/mysql$BS client/mysqlshow$BS client/mysqladmin$BS \
+ client/mysqlslap$BS \
client/mysqldump$BS client/mysqlimport$BS \
client/mysqltest$BS client/mysqlcheck$BS \
client/mysqlbinlog$BS client/mysql_upgrade$BS \
@@ -192,42 +354,16 @@ BIN_FILES="extra/comp_err$BS extra/replace$BS extra/perror$BS \
";
# Platform-specific bin dir files:
-if [ $BASE_SYSTEM = "netware" ] ; then
- BIN_FILES="$BIN_FILES \
+BIN_FILES="$BIN_FILES \
netware/mysqld_safe$BS netware/mysql_install_db$BS \
- netware/init_db.sql netware/test_db.sql netware/mysql_explain_log$BS \
+ netware/init_db.sql netware/test_db.sql \
netware/mysqlhotcopy$BS netware/libmysql$BS netware/init_secure_db.sql \
";
-# For all other platforms:
-else
- BIN_FILES="$BIN_FILES \
- server-tools/instance-manager/.libs/mysqlmanager \
- client/mysqltestmanagerc \
- client/mysqltestmanager-pwgen tools/mysqltestmanager \
- client/.libs/mysql client/.libs/mysqlshow client/.libs/mysqladmin \
- client/.libs/mysqldump client/.libs/mysqlimport \
- client/.libs/mysqltest client/.libs/mysqlcheck \
- client/.libs/mysqlbinlog client/.libs/mysqltestmanagerc \
- client/.libs/mysqltestmanager-pwgen tools/.libs/mysqltestmanager \
- tests/.libs/mysql_client_test \
- libmysqld/examples/.libs/mysql_client_test_embedded \
- libmysqld/examples/.libs/mysqltest_embedded \
- ";
-fi
copyfileto $BASE/bin $BIN_FILES
-if [ x$STRIP = x1 ] ; then
- strip $BASE/bin/*
-fi
-
-# Copy not binary files
-copyfileto $BASE/bin sql/mysqld.sym.gz
-
-if [ $BASE_SYSTEM = "netware" ] ; then
- $CP netware/*.pl $BASE/scripts
- $CP scripts/mysqlhotcopy $BASE/scripts/mysqlhotcopy.pl
-fi
+$CP netware/*.pl $BASE/scripts
+$CP scripts/mysqlhotcopy $BASE/scripts/mysqlhotcopy.pl
copyfileto $BASE/lib \
libmysql/.libs/libmysqlclient.a \
@@ -249,33 +385,20 @@ copyfileto $BASE/lib \
zlib/.libs/libz.a
# convert the .a to .lib for NetWare
-if [ $BASE_SYSTEM = "netware" ] ; then
- for i in $BASE/lib/*.a
- do
- libname=`basename $i .a`
- $MV $i $BASE/lib/$libname.lib
- done
- rm -f $BASE/lib/*.la
-fi
+for i in $BASE/lib/*.a
+do
+ libname=`basename $i .a`
+ $MV $i $BASE/lib/$libname.lib
+done
+rm -f $BASE/lib/*.la
+
-copyfileto $BASE/include include/*
+copyfileto $BASE/include config.h include/*
rm -f $BASE/include/Makefile* $BASE/include/*.in $BASE/include/config-win.h
-if [ $BASE_SYSTEM != "netware" ] ; then
- rm -f $BASE/include/config-netware.h
-fi
-if [ $BASE_SYSTEM != "netware" ] ; then
- if [ -d tests ] ; then
- $CP tests/*.res tests/*.tst tests/*.pl $BASE/tests
- fi
- if [ -d man ] ; then
- $CP man/*.1 $BASE/man/man1
- $CP man/*.8 $BASE/man/man8
- # In a Unix binary package, these tools and their manuals are not useful
- rm -f $BASE/man/man1/make_win_*
- fi
-fi
+# In a NetWare binary package, these tools and their manuals are not useful
+rm -f $BASE/man/man1/make_win_*
copyfileto $BASE/support-files support-files/*
@@ -294,43 +417,29 @@ copyfileto $BASE/mysql-test \
$CP mysql-test/lib/*.pl $BASE/mysql-test/lib
$CP mysql-test/t/*.def $BASE/mysql-test/t
$CP mysql-test/include/*.inc $BASE/mysql-test/include
+$CP mysql-test/include/*.sql $BASE/mysql-test/include
$CP mysql-test/include/*.test $BASE/mysql-test/include
$CP mysql-test/t/*.def $BASE/mysql-test/t
+$CP mysql-test/std_data/*.dat mysql-test/std_data/*.frm \
+ mysql-test/std_data/*.MYD mysql-test/std_data/*.MYI \
+ mysql-test/std_data/*.pem mysql-test/std_data/Moscow_leap \
+ mysql-test/std_data/Index.xml \
+ mysql-test/std_data/des_key_file mysql-test/std_data/*.*001 \
+ mysql-test/std_data/*.cnf mysql-test/std_data/*.MY* \
+ $BASE/mysql-test/std_data
$CP mysql-test/t/*.test mysql-test/t/*.imtest \
mysql-test/t/*.disabled mysql-test/t/*.opt \
mysql-test/t/*.slave-mi mysql-test/t/*.sh mysql-test/t/*.sql $BASE/mysql-test/t
$CP mysql-test/r/*.result mysql-test/r/*.require \
$BASE/mysql-test/r
-# Copy the additional suites and data "as is", they are in flux
-$tar cf - mysql-test/suite | ( cd $BASE ; $tar xf - )
-$tar cf - mysql-test/std_data | ( cd $BASE ; $tar xf - )
+# Copy the additional suites "as is", they are in flux
+$tar cf - mysql-test/suite | ( cd $BASE ; $tar xf - )
# Clean up if we did this from a bk tree
if [ -d mysql-test/SCCS ] ; then
find $BASE/mysql-test -name SCCS -print | xargs rm -rf
fi
-if [ $BASE_SYSTEM != "netware" ] ; then
- chmod a+x $BASE/bin/*
- copyfileto $BASE/bin scripts/*
- $BASE/bin/replace \@localstatedir\@ ./data \@bindir\@ ./bin \@scriptdir\@ \
- ./bin \@libexecdir\@ ./bin \@sbindir\@ ./bin \@prefix\@ . \@HOSTNAME\@ \
- @HOSTNAME@ \@pkgdatadir\@ ./share \
- < scripts/mysql_install_db.sh > $BASE/scripts/mysql_install_db
- $BASE/bin/replace \@prefix\@ /usr/local/mysql \@bindir\@ ./bin \
- \@sbindir\@ ./bin \@libexecdir\@ ./bin \
- \@MYSQLD_USER\@ @MYSQLD_USER@ \@localstatedir\@ /usr/local/mysql/data \
- \@HOSTNAME\@ @HOSTNAME@ \
- < support-files/mysql.server.sh > $BASE/support-files/mysql.server
- $BASE/bin/replace /my/gnu/bin/hostname /bin/hostname -- $BASE/bin/mysqld_safe
- mv $BASE/support-files/binary-configure $BASE/configure
- chmod a+x $BASE/bin/* $BASE/scripts/* $BASE/support-files/mysql-log-rotate \
- $BASE/support-files/*.server $BASE/configure
- $CP -r sql-bench/* $BASE/sql-bench
- rm -f $BASE/sql-bench/*.sh $BASE/sql-bench/Makefile* $BASE/lib/*.la
- rm -f $BASE/bin/*.sql
-fi
-
rm -f $BASE/bin/Makefile* $BASE/bin/*.in $BASE/bin/*.sh \
$BASE/bin/mysql_install_db $BASE/bin/make_binary_distribution \
$BASE/bin/make_win_* \
@@ -340,29 +449,19 @@ rm -f $BASE/bin/Makefile* $BASE/bin/*.in $BASE/bin/*.sh \
#
# Copy system dependent files
#
-if [ $BASE_SYSTEM = "netware" ] ; then
- ./scripts/fill_help_tables < ./Docs/manual.texi >> ./netware/init_db.sql
-fi
+./scripts/fill_help_tables < ./Docs/manual.texi >> ./netware/init_db.sql
#
# Remove system dependent files
#
-if [ $BASE_SYSTEM = "netware" ] ; then
- rm -f $BASE/support-files/magic \
+rm -f $BASE/support-files/magic \
$BASE/support-files/mysql.server \
$BASE/support-files/mysql*.spec \
$BASE/support-files/mysql-log-rotate \
$BASE/support-files/binary-configure \
$BASE/support-files/build-tags \
$BASE/support-files/MySQL-shared-compat.spec \
- $BASE/support-files/ndb-config-2-node.ini \
$BASE/INSTALL-BINARY
-fi
-
-# Make safe_mysqld a symlink to mysqld_safe for backwards portability
-if [ $BASE_SYSTEM != "netware" ] ; then
- (cd $BASE/bin ; ln -s mysqld_safe safe_mysqld )
-fi
# Clean up if we did this from a bk tree
if [ -d $BASE/sql-bench/SCCS ] ; then
@@ -370,78 +469,17 @@ if [ -d $BASE/sql-bench/SCCS ] ; then
find $BASE/sql-bench -name SCCS -print | xargs rm -rf
fi
-# NDB Cluster
-if [ x$NDBCLUSTER = x1 ]; then
- ( cd ndb ; @MAKE@ DESTDIR=$BASE/ndb-stage install pkglibdir=@pkglibdir@ )
- ( cd mysql-test/ndb ; @MAKE@ DESTDIR=$BASE/ndb-stage install pkglibdir=@pkglibdir@ )
- $CP $BASE/ndb-stage@bindir@/* $BASE/bin/.
- $CP $BASE/ndb-stage@libexecdir@/* $BASE/bin/.
- $CP $BASE/ndb-stage@pkglibdir@/* $BASE/lib/.
- $CP $BASE/ndb-stage@pkgdatadir@/* $BASE/share/mysql/.
- $CP -r $BASE/ndb-stage@pkgincludedir@/ndb $BASE/include
- $CP -r $BASE/ndb-stage@prefix@/mysql-test/ndb $BASE/mysql-test/. || exit 1
- rm -rf $BASE/ndb-stage
-fi
-
-# Change the distribution to a long descriptive name
-NEW_NAME=mysql@MYSQL_SERVER_SUFFIX@-$version-$platform$SUFFIX
-
-# Print the platform name for build logs
-echo "PLATFORM NAME: $platform"
-
BASE2=$TMP/$NEW_NAME
rm -rf $BASE2
mv $BASE $BASE2
BASE=$BASE2
+
#
-# If we are compiling with gcc, copy libgcc.a to the distribution as libmygcc.a
+# Create a zip file for NetWare users
#
-
-if [ x"@GXX@" = x"yes" ] ; then
- gcclib=`@CC@ @CFLAGS@ --print-libgcc-file 2>/dev/null` || true
- if [ -z "$gcclib" ] ; then
- echo "Warning: Compiler doesn't tell libgcc.a!"
- elif [ -f "$gcclib" ] ; then
- $CP $gcclib $BASE/lib/libmygcc.a
- else
- echo "Warning: Compiler result '$gcclib' not found / no file!"
- fi
-fi
-
-#if we are debugging, do not do tar/gz
-if [ x$DEBUG = x1 ] ; then
- exit
-fi
-
-if [ $BASE_SYSTEM != "netware" ] ; then
-
- #
- # Create the result tar file
- #
-
- echo "Using $tar to create archive"
-
- OPT=cvf
- if [ x$SILENT = x1 ] ; then
- OPT=cf
- fi
-
- echo "Creating and compressing archive"
- rm -f $NEW_NAME.tar.gz
- (cd $TMP ; $tar $OPT - $NEW_NAME) | gzip -9 > $NEW_NAME.tar.gz
- echo "$NEW_NAME.tar.gz created"
-
-else
-
- #
- # Create a zip file for NetWare users
- #
-
- rm -f $NEW_NAME.zip
- (cd $TMP; zip -r "$SOURCE/$NEW_NAME.zip" $NEW_NAME)
- echo "$NEW_NAME.zip created"
-
-fi
+rm -f $NEW_NAME.zip
+(cd $TMP; zip -r "$SOURCE/$NEW_NAME.zip" $NEW_NAME)
+echo "$NEW_NAME.zip created"
echo "Removing temporary directory"
rm -rf $BASE
diff --git a/scripts/make_win_bin_dist b/scripts/make_win_bin_dist
index 24e869fe6a4..3360d8459f8 100755
--- a/scripts/make_win_bin_dist
+++ b/scripts/make_win_bin_dist
@@ -145,7 +145,7 @@ mkdir $DESTDIR
mkdir $DESTDIR/bin
cp client/$TARGET/*.exe $DESTDIR/bin/
cp extra/$TARGET/*.exe $DESTDIR/bin/
-cp myisam/$TARGET/*.exe $DESTDIR/bin/
+cp storage/myisam/$TARGET/*.exe $DESTDIR/bin/
cp server-tools/instance-manager/$TARGET/*.{exe,map} $DESTDIR/bin/
if [ x"$TARGET" != x"release" ] ; then
cp server-tools/instance-manager/$TARGET/*.pdb $DESTDIR/bin/
@@ -159,30 +159,17 @@ fi
cp tests/$TARGET/*.exe $DESTDIR/bin/
cp libmysql/$TARGET/libmysql.dll $DESTDIR/bin/
-if [ -f "sql/$TARGET/mysqld-nt.exe" ] ; then
- BASENAME="mysqld-nt" # Old style non CMake build
-else
- BASENAME="mysqld" # New style CMake build
-fi
-
-# Depending on Visual Studio target, the optimized server has symbols
-cp sql/$TARGET/$BASENAME.exe $DESTDIR/bin/$BASENAME$EXE_SUFFIX.exe
-cp sql/$TARGET/$BASENAME.map $DESTDIR/bin/$BASENAME$EXE_SUFFIX.map
+cp sql/$TARGET/mysqld.exe $DESTDIR/bin/mysqld$EXE_SUFFIX.exe
+cp sql/$TARGET/mysqld.map $DESTDIR/bin/mysqld$EXE_SUFFIX.map
if [ x"$TARGET" != x"release" ] ; then
- cp sql/$TARGET/$BASENAME.pdb $DESTDIR/bin/$BASENAME$EXE_SUFFIX.pdb
+ cp sql/$TARGET/mysqld.pdb $DESTDIR/bin/mysqld$EXE_SUFFIX.pdb
fi
-if [ -f "sql/debug/mysqld-debug.exe" ] ; then
- BASENAME="mysqld-debug" # Old style non CMake build
-else
- BASENAME="mysqld" # New style CMake build
-fi
-
-if [ x"$PACK_DEBUG" = x"" -a -f "sql/debug/$BASENAME.exe" -o \
+if [ x"$PACK_DEBUG" = x"" -a -f "sql/debug/mysqld.exe" -o \
x"$PACK_DEBUG" = x"yes" ] ; then
- cp sql/debug/$BASENAME.exe $DESTDIR/bin/mysqld-debug.exe
- cp sql/debug/$BASENAME.pdb $DESTDIR/bin/mysqld-debug.pdb
- cp sql/debug/$BASENAME.map $DESTDIR/bin/mysqld-debug.map
+ cp sql/debug/mysqld.exe $DESTDIR/bin/mysqld-debug.exe
+ cp sql/debug/mysqld.pdb $DESTDIR/bin/mysqld-debug.pdb
+ cp sql/debug/mysqld.map $DESTDIR/bin/mysqld-debug.map
fi
# ----------------------------------------------------------------------
@@ -263,7 +250,6 @@ cp include/mysql.h \
include/mysql_embed.h \
include/my_pthread.h \
include/my_no_pthread.h \
- include/raid.h \
include/decimal.h \
include/errmsg.h \
include/my_global.h \
@@ -285,6 +271,9 @@ cp include/mysql.h \
libmysql/libmysql.def \
$DESTDIR/include/
+mkdir -p $DESTDIR/include/mysql
+cp include/mysql/plugin.h $DESTDIR/include/mysql/
+
# ----------------------------------------------------------------------
# Client libraries, and other libraries
# ----------------------------------------------------------------------
@@ -347,11 +336,8 @@ fi
mysql_scripts="\
mysql_config.pl \
mysql_convert_table_format.pl \
-mysql_explain_log.pl \
mysql_install_db.pl \
mysql_secure_installation.pl \
-mysql_tableinfo.pl \
-mysql_upgrade_shell.pl \
mysqld_multi.pl \
mysqldumpslow.pl \
mysqlhotcopy.pl \
diff --git a/scripts/make_win_src_distribution_old.sh b/scripts/make_win_src_distribution_old.sh
deleted file mode 100644
index dfb43585a21..00000000000
--- a/scripts/make_win_src_distribution_old.sh
+++ /dev/null
@@ -1,560 +0,0 @@
-#!/bin/sh
-# Copyright (C) 2003-2006 MySQL AB
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; version 2 of the License.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-
-# NOTE: This script creates a source TAR and ZIP to be used when
-# building using Visual Studio 2003 .Net. To gain more flexibility, a
-# new CMake build was added. The new build obsoletes this script, Unix
-# and Windows share the same source TAR/ZIP.
-# Also note that the old build from source created by this script is
-# no longer tested by MySQL AB and may not work. Please use the new
-# CMake based build.
-
-# Terminate loudly on error, we don't want partial package
-set -e
-trap "echo '*** script failed ***'" 0
-
-#
-# Script to create a Windows src package
-#
-
-version=@VERSION@
-CP="cp -p"
-
-DEBUG=0
-SILENT=0
-SUFFIX=""
-DIRNAME=""
-OUTTAR="0"
-OUTZIP="0"
-
-#
-# An "abort" function taking a variable number of strings (one per line)
-#
-
-abort()
-{
- for line
- do
- echo "$line"
- done
- exit 1
-}
-
-
-#
-# This script must run from MySQL top directory
-#
-
-if [ ! -f scripts/make_win_src_distribution ]; then
- abort "ERROR : You must run this script from the MySQL top-level directory"
-fi
-SOURCE=`pwd`
-
-#
-# Check for source compilation/configuration
-#
-
-if [ ! -f sql/sql_yacc.cc ]; then
- abort "ERROR : Sorry, you must run this script after the complete build," \
- " hope you know what you are trying to do !!"
-fi
-
-#
-# Debug print of the status
-#
-
-print_debug()
-{
- for statement
- do
- if [ "$DEBUG" = "1" ] ; then
- echo $statement
- fi
- done
-}
-
-#
-# Usage of the script
-#
-
-show_usage()
-{
- echo "MySQL utility script to create a Windows src package, and it takes"
- echo "the following arguments:"
- echo ""
- echo " --debug Debug, without creating the package"
- echo " --tmp Specify the temporary location"
- echo " --suffix Suffix name for the package"
- echo " --dirname Directory name to copy files (intermediate)"
- echo " --silent Show no progress information"
- echo " --tar Create tar.gz package"
- echo " --zip Create zip package"
- echo " --help Show this help message"
-
- exit 0
-}
-
-#
-# Parse the input arguments
-#
-
-parse_arguments() {
- for arg do
- case "$arg" in
- --add-tar) ADDTAR=1 ;;
- --debug) DEBUG=1;;
- --tmp=*) TMP=`echo "$arg" | sed -e "s;--tmp=;;"` ;;
- --suffix=*) SUFFIX=`echo "$arg" | sed -e "s;--suffix=;;"` ;;
- --dirname=*) DIRNAME=`echo "$arg" | sed -e "s;--dirname=;;"` ;;
- --silent) SILENT=1 ;;
- --tar) OUTTAR=1 ;;
- --zip) OUTZIP=1 ;;
- --help) show_usage ;;
- *) abort "Unknown argument '$arg'"
- ;;
- esac
- done
-}
-
-parse_arguments "$@"
-
-#
-# Assign the tmp directory if it was set from the environment variables
-#
-
-for i in $TMP $TMPDIR $TEMPDIR $TEMP /tmp
-do
- if [ "$i" ]; then
- print_debug "Setting TMP to '$i'"
- TMP=$i
- break
- fi
-done
-
-
-#
-# Convert argument file from unix to DOS text
-#
-
-unix_to_dos()
-{
- for arg do
- print_debug "Replacing LF -> CRLF from '$arg'"
-
- awk '{sub(/$/,"\r");print}' < $arg > $arg.tmp
- rm -f $arg
- mv $arg.tmp $arg
- done
-}
-
-
-#
-# Create a tmp dest directory to copy files
-#
-
-BASE=$TMP/my_win_dist$SUFFIX.$$
-trap "rm -r -f $BASE; echo '*** interrupted ***'; exit 1" 1 2 3 13 15
-
-if [ -d $BASE ] ; then
- echo "WARNING: Destination directory '$BASE' already exists, deleting it"
- rm -r -f $BASE
-fi
-
-$CP -r $SOURCE/VC++Files $BASE
-# This includes an implicit 'mkdir $BASE' !
-
-#
-# Process version tags in InstallShield files
-#
-
-vreplace()
-{
- for arg do
- unix_to_dos $arg
- cat $arg | sed -e 's!@''VERSION''@!@VERSION@!' > $arg.tmp
- rm -f $arg
- mv $arg.tmp $arg
- done
-}
-
-if test -d $BASE/InstallShield
-then
- for d in 4.1.XX-gpl 4.1.XX-pro 4.1.XX-classic
- do
- cd $BASE/InstallShield/$d/String\ Tables/0009-English
- vreplace value.shl
- cd ../../Setup\ Files/Compressed\ Files/Language\ Independent/OS\ Independent
- vreplace infolist.txt
- done
-fi
-
-#
-# Move all error message files to root directory
-#
-
-$CP -r $SOURCE/sql/share $BASE/
-rm -r -f "$BASE/share/Makefile"
-rm -r -f "$BASE/share/Makefile.in"
-rm -r -f "$BASE/share/Makefile.am"
-
-mkdir $BASE/Docs $BASE/extra $BASE/include
-
-#
-# Copy directory files
-#
-
-copy_dir_files()
-{
- for arg do
- print_debug "Copying files from directory '$arg'"
- cd $SOURCE/$arg
- if [ ! -d $BASE/$arg ]; then
- print_debug "Creating directory '$arg'"
- mkdir $BASE/$arg
- fi
- for i in *.c *.cpp *.h *.ih *.i *.ic *.asm *.def *.hpp *.yy *dsp *.dsw \
- README INSTALL* LICENSE AUTHORS NEWS ChangeLog \
- *.inc *.test *.result *.pem Moscow_leap des_key_file \
- *.vcproj *.sln *.dat *.000001 *.require *.opt *.cnf
- do
- if [ -f $i ]
- then
- $CP $SOURCE/$arg/$i $BASE/$arg/$i
- fi
- done
- for i in *.cc
- do
- if [ -f $i ]
- then
- i=`echo $i | sed 's/.cc$//g'`
- $CP $SOURCE/$arg/$i.cc $BASE/$arg/$i.cpp
- fi
- done
- done
-}
-
-#
-# Copy directory contents recursively
-#
-
-copy_dir_dirs() {
-
- for arg do
-
- cd $SOURCE
- (
- find $arg -type d \
- -and -not -path \*SCCS\* \
- -and -not -path \*.deps\* \
- -and -not -path \*.libs\* \
- -and -not -path \*autom4te.cache -print
- )|(
- while read v
- do
- copy_dir_files $v
- done
- )
-
- done
-}
-
-#
-# Input directories to be copied
-#
-
-for i in client dbug extra heap include \
- libmysql libmysqld myisam \
- myisammrg mysys regex sql strings sql-common sql/examples \
- tools vio zlib
-do
- copy_dir_files $i
-done
-
-#
-# Create project files for ndb
-#
-make -C $SOURCE/ndb windoze || true
-
-#
-# Input directories to be copied recursively
-#
-
-for i in bdb innobase ndb extra/yassl server-tools
-do
- copy_dir_dirs $i
-done
-
-#
-# Create dummy innobase configure header
-#
-
-if [ -f $BASE/innobase/ib_config.h ]; then
- rm -f $BASE/innobase/ib_config.h
-fi
-touch $BASE/innobase/ib_config.h
-
-
-#
-# Copy miscellaneous files
-#
-
-cd $SOURCE
-for i in COPYING ChangeLog README EXCEPTIONS-CLIENT\
- INSTALL-SOURCE INSTALL-WIN \
- INSTALL-WIN-SOURCE \
- Docs/INSTALL-BINARY Docs/manual.chm
-do
- print_debug "Copying file '$i'"
- if [ -f $i ]
- then
- $CP $i $BASE/$i
- fi
-done
-
-#
-# support files
-#
-mkdir $BASE/support-files
-
-# Rename the cnf files to <file>.ini
-for i in support-files/*.cnf
-do
- i=`echo $i | sed 's/.cnf$//g'`
- cp $i.cnf $BASE/$i.ini
-done
-
-#
-# Raw dirs from source tree
-#
-
-for i in scripts sql-bench mysql-test SSL tests
-do
- print_debug "Copying directory '$i'"
- if [ -d $i ]
- then
- if [ -d $BASE/$i ]
- then
- $CP -R $i $BASE
- else
- $CP -R $i $BASE/$i
- fi
- fi
- # But remove object files from destination
- find $BASE/$i -type f -name \*.o | xargs rm -f
-done
-
-#
-# Fix some windows files to avoid compiler warnings
-#
-
-if [ -x extra/replace ] ; then
- ./extra/replace std:: "" < $BASE/sql/sql_yacc.cpp | \
- sed '/^ *switch (yytype)$/ { N; /\n *{$/ { N; /\n *default:$/ { N; /\n *break;$/ { N; /\n *}$/ d; };};};} ' \
- > $BASE/sql/sql_yacc.cpp-new
- mv $BASE/sql/sql_yacc.cpp-new $BASE/sql/sql_yacc.cpp
-else
- if [ "$SILENT" = "0" ] ; then
- echo 'WARNING: "extra/replace" not built, can not filter "sql_yacc.ccp"'
- echo 'WARNING: to reduce the number of warnings when building'
- fi
-fi
-
-#
-# Search the tree for plain text files and adapt the line end marker
-#
-find $BASE \( -name "*.cnf" -o -name "*.ini" \
- -o -name COPYING -o -name ChangeLog -o -name EXCEPTIONS-CLIENT \
- -o -name "INSTALL*" -o -name LICENSE -o -name "README*" \
- -o -name "*.dsp" -o -name "*.dsw" \
- -o -name "*.vcproj" -o -name "*.sln" \) -type f -print \
-| while read v
- do
- unix_to_dos $v
- done
-
-mv $BASE/README $BASE/README.txt
-
-#
-# Clean up if we did this from a bk tree
-#
-
-find $BASE -type d \( -name SCCS -o -name .deps -o -name .libs \) -print0 | \
-xargs -0 rm -r -f
-rm -r -f "$BASE/mysql-test/var"
-
-#
-# Initialize the initial data directory
-#
-
-if [ ! -f scripts/mysql_install_db ] ; then
- if [ "$SILENT" = "0" ] ; then
- echo 'WARNING: "scripts/mysql_install_db" is not built, can not initiate databases'
- fi
-elif [ ! -f extra/my_print_defaults ]; then
- if [ "$SILENT" = "0" ] ; then
- echo 'WARNING: "extra/my_print_defaults" is not built, can not initiate databases'
- fi
-else
- print_debug "Initializing the 'data' directory"
- scripts/mysql_install_db --no-defaults --windows --datadir=$BASE/data
- if test "$?" = 1
- then
- exit 1;
- fi
-fi
-
-#
-# Specify the distribution package name and copy it
-#
-
-if test -z $DIRNAME
-then
- NEW_DIR_NAME=mysql@MYSQL_SERVER_SUFFIX@-$version$SUFFIX
-else
- NEW_DIR_NAME=$DIRNAME
-fi
-NEW_NAME=$NEW_DIR_NAME-win-src
-
-BASE2=$TMP/$NEW_DIR_NAME
-rm -r -f $BASE2
-mv $BASE $BASE2
-BASE=$BASE2
-
-#
-# If debugging, don't create a zip/tar/gz
-#
-
-if [ "$DEBUG" = "1" ] ; then
- echo "Please check the distribution files from $BASE"
- echo "Exiting (without creating the package).."
- exit
-fi
-
-#
-# This is needed to prefere gnu tar instead of tar because tar can't
-# always handle long filenames
-#
-
-PATH_DIRS=`echo $PATH | sed -e 's/^:/. /' -e 's/:$/ ./' -e 's/::/ . /g' -e 's/:/ /g' `
-which_1 ()
-{
- for cmd
- do
- for d in $PATH_DIRS
- do
- for file in $d/$cmd
- do
- if test -x $file -a ! -d $file
- then
- echo $file
- exit 0
- fi
- done
- done
- done
- exit 1
-}
-
-#
-# Create the result zip/tar file
-#
-
-if [ "$OUTTAR" = "0" ]; then
- if [ "$OUTZIP" = "0" ]; then
- OUTZIP=1
- fi
-fi
-
-set_tarzip_options()
-{
- for arg
- do
- if [ "$arg" = "tar" ]; then
- ZIPFILE1=gnutar
- ZIPFILE2=gtar
- OPT=cf
- EXT=".tar"
- NEED_COMPRESS=1
- else
- ZIPFILE1=zip
- ZIPFILE2=""
- OPT="-r -q"
- EXT=".zip"
- NEED_COMPRESS=0
- fi
- done
-}
-
-
-#
-# Create the archive
-#
-create_archive()
-{
-
- print_debug "Using $tar to create archive"
-
- cd $TMP
-
- rm -f $SOURCE/$NEW_NAME$EXT
- $tar $OPT $SOURCE/$NEW_NAME$EXT $NEW_DIR_NAME
- cd $SOURCE
-
- if [ "$NEED_COMPRESS" = "1" ]
- then
- print_debug "Compressing archive"
- gzip -9 $NEW_NAME$EXT
- EXT="$EXT.gz"
- fi
-
- if [ "$SILENT" = "0" ] ; then
- echo "$NEW_NAME$EXT created successfully !!"
- fi
-}
-
-if [ "$OUTTAR" = "1" ]; then
- set_tarzip_options 'tar'
-
- tar=`which_1 $ZIPFILE1 $ZIPFILE2`
- if test "$?" = "1" -o "$tar" = ""
- then
- print_debug "Search failed for '$ZIPFILE1', '$ZIPFILE2', using default 'tar'"
- tar=tar
- set_tarzip_options 'tar'
- fi
-
- create_archive
-fi
-
-if [ "$OUTZIP" = "1" ]; then
- set_tarzip_options 'zip'
-
- tar=`which_1 $ZIPFILE1 $ZIPFILE2`
- if test "$?" = "1" -o "$tar" = ""
- then
- echo "Search failed for '$ZIPFILE1', '$ZIPFILE2', cannot create zip!"
- fi
-
- create_archive
-fi
-
-print_debug "Removing temporary directory"
-rm -r -f $BASE
-
-# No need to report anything if we got here
-trap "" 0
-
-# End of script
diff --git a/scripts/mysql_config.pl.in b/scripts/mysql_config.pl.in
index 3ae8baf7db0..21896711fa8 100644
--- a/scripts/mysql_config.pl.in
+++ b/scripts/mysql_config.pl.in
@@ -202,7 +202,7 @@ $flags->{libs} =
$flags->{libs_r} =
[@ldflags,@lib_r_opts,'@ZLIB_DEPS@','@LIBS@','@openssl_libs@'];
$flags->{embedded_libs} =
- [@ldflags,@lib_e_opts,'@ZLIB_DEPS@','@LIBS@','@WRAPLIBS@','@innodb_system_libs@','@openssl_libs@'];
+ [@ldflags,@lib_e_opts,'@LIBDL@','@ZLIB_DEPS@','@LIBS@','@WRAPLIBS@','@innodb_system_libs@','@openssl_libs@'];
$flags->{include} = ["-I$pkgincludedir"];
$flags->{cflags} = [@{$flags->{include}},split(" ",'@CFLAGS@')];
diff --git a/scripts/mysql_config.sh b/scripts/mysql_config.sh
index 915f623578d..efc82544bc0 100644
--- a/scripts/mysql_config.sh
+++ b/scripts/mysql_config.sh
@@ -87,6 +87,8 @@ pkglibdir='@pkglibdir@'
pkglibdir_rel=`echo $pkglibdir | sed -e "s;^$basedir/;;"`
fix_path pkglibdir $pkglibdir_rel lib/mysql lib
+plugindir='@pkgplugindir@'
+
pkgincludedir='@pkgincludedir@'
fix_path pkgincludedir include/mysql include
@@ -105,7 +107,7 @@ fi
libs=" $ldflags -L$pkglibdir -lmysqlclient @ZLIB_DEPS@ @NON_THREADED_LIBS@"
libs="$libs @openssl_libs@ @STATIC_NSS_FLAGS@ "
libs_r=" $ldflags -L$pkglibdir -lmysqlclient_r @ZLIB_DEPS@ @LIBS@ @openssl_libs@ "
-embedded_libs=" $ldflags -L$pkglibdir -lmysqld @ZLIB_DEPS@ @LIBS@ @WRAPLIBS@ @innodb_system_libs@ @openssl_libs@ "
+embedded_libs=" $ldflags -L$pkglibdir -lmysqld @LIBDL@ @ZLIB_DEPS@ @LIBS@ @WRAPLIBS@ @innodb_system_libs@ @openssl_libs@ "
if [ -r "$pkglibdir/libmygcc.a" ]; then
# When linking against the static library with a different version of GCC
@@ -160,6 +162,7 @@ Options:
--include [$include]
--libs [$libs]
--libs_r [$libs_r]
+ --plugindir [$plugindir]
--socket [$socket]
--port [$port]
--version [$version]
@@ -176,6 +179,7 @@ while test $# -gt 0; do
--include) echo "$include" ;;
--libs) echo "$libs" ;;
--libs_r) echo "$libs_r" ;;
+ --plugindir) echo "$plugindir" ;;
--socket) echo "$socket" ;;
--port) echo "$port" ;;
--version) echo "$version" ;;
diff --git a/scripts/mysql_convert_table_format.sh b/scripts/mysql_convert_table_format.sh
index 833b5bf5f11..6f586d0e8e0 100644
--- a/scripts/mysql_convert_table_format.sh
+++ b/scripts/mysql_convert_table_format.sh
@@ -23,18 +23,30 @@ $opt_help=$opt_version=$opt_verbose=$opt_force=0;
$opt_user=$opt_database=$opt_password=undef;
$opt_host="localhost";
$opt_socket="";
-$opt_type="MYISAM";
+$opt_engine="MYISAM";
$opt_port=0;
$exit_status=0;
-GetOptions("force","help","host=s","password=s","user=s","type=s","verbose","version","socket=s", "port=i") ||
- usage(0);
+GetOptions(
+ "e|engine|type=s" => \$opt_type,
+ "f|force" => \$opt_force,
+ "help|?" => \$opt_help,
+ "h|host=s" => \$opt_host,
+ "p|password=s" => \$opt_password,
+ "u|user=s" => \$opt_user,
+ "v|verbose" => \$opt_verbose,
+ "V|version" => \$opt_version,
+ "S|socket=s" => \$opt_socket,
+ "P|port=i" => \$opt_port
+) || usage(0);
+
usage($opt_version) if ($#ARGV < 0 || $opt_help || $opt_version);
+
$opt_database=shift(@ARGV);
-if (uc($opt_type) eq "HEAP")
+if (grep { /^$opt_engine$/i } qw(HEAP MEMORY BLACKHOLE))
{
- print "Converting to type HEAP would delete your tables; aborting\n";
+ print "Converting to '$opt_engine' would delete your data; aborting\n";
exit(1);
}
@@ -54,21 +66,29 @@ $dbh = DBI->connect("DBI:mysql:$opt_database:${opt_host}$connect_opt",
{ PrintError => 0})
|| die "Can't connect to database $opt_database: $DBI::errstr\n";
-if ($#ARGV < 0)
+my @tables;
+
+push(@ARGV, "%") if(!@ARGV);
+
+foreach $pattern (@ARGV)
{
- # Fetch all table names from the database
my ($sth,$row);
- $sth=$dbh->prepare("show tables");
- $sth->execute || die "Can't get tables from $opt_database; $DBI::errstr\n";
+ $sth=$dbh->prepare("SHOW TABLES LIKE ?");
+ $rv= $sth->execute($pattern);
+ if(!int($rv))
+ {
+ warn "Can't get tables matching '$pattern' from $opt_database; $DBI::errstr\n";
+ exit(1) unless $opt_force;
+ }
while (($row = $sth->fetchrow_arrayref))
{
- push(@ARGV,$row->[0]);
+ push(@tables, $row->[0]);
}
$sth->finish;
}
print "Converting tables:\n" if ($opt_verbose);
-foreach $table (@ARGV)
+foreach $table (@tables)
{
my ($sth,$row);
@@ -76,14 +96,15 @@ foreach $table (@ARGV)
$sth=$dbh->prepare("show table status like '$table'");
if ($sth->execute && ($row = $sth->fetchrow_arrayref))
{
- if (uc($row->[1]) eq uc($opt_type))
+ if (uc($row->[1]) eq uc($opt_engine))
{
- print "$table is already of type $opt_type; Ignored\n";
+ print "$table already uses the '$opt_engine' engine; Ignored\n";
next;
}
}
print "converting $table\n" if ($opt_verbose);
- if (!$dbh->do("ALTER TABLE $table type=$opt_type"))
+ $table=~ s/`/``/g;
+ if (!$dbh->do("ALTER TABLE `$table` ENGINE=$opt_engine"))
{
print STDERR "Can't convert $table: Error $DBI::errstr\n";
exit(1) if (!$opt_force);
@@ -103,43 +124,43 @@ sub usage
print <<EOF;
-Conversion of a MySQL tables to other table types.
+Conversion of a MySQL tables to other storage engines
- Usage: $0 database [tables]
+ Usage: $0 database [table[ table ...]]
If no tables has been specifed, all tables in the database will be converted.
+ You can also use wildcards, ie "my%"
The following options are available:
---force
+-f, --force
Continue even if there is some error.
---help or --Information
+-?, --help
Shows this help
---host='host name' (Default $opt_host)
- Host name where the database server is located.
+-e, --engine=ENGINE
+ Converts tables to the given storage engine (Default: $opt_engine)
---password='password'
+-h, --host=HOST
+ Host name where the database server is located. (Default: $opt_host)
+
+-p, --password=PASSWORD
Password for the current user.
---port=port
+-P, --port=PORT
TCP/IP port to connect to if host is not "localhost".
---socket='/path/to/socket'
+-S, --socket=SOCKET
Socket to connect with.
---type='table-type'
- Converts tables to the given table type (Default: $opt_type)
- MySQL 3.23 supports at least the BDB, ISAM and MYISAM types.
-
---user='user_name'
+-u, --user=USER
User name to log into the SQL server.
---verbose
+-v, --verbose
This is a test specific option that is only used when debugging a test.
Print more information about what is going on.
---version
+-V, --version
Shows the version of this program.
EOF
exit(1);
diff --git a/scripts/mysql_explain_log.sh b/scripts/mysql_explain_log.sh
deleted file mode 100644
index 30bee722873..00000000000
--- a/scripts/mysql_explain_log.sh
+++ /dev/null
@@ -1,414 +0,0 @@
-#!/usr/bin/perl
-# Copyright (C) 2001-2003, 2006 MySQL AB
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; version 2 of the License.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-
-use strict;
-use warnings;
-use DBI;
-
-use Getopt::Long;
-$Getopt::Long::ignorecase=0;
-
-my $Param={};
-
-$Param->{host}='';
-$Param->{user}='';
-$Param->{password}='';
-$Param->{PrintError}=0;
-$Param->{socket}='';
-
-my $help;
-
-if (!GetOptions (
- 'date|d:i' => \$Param->{ViewDate},
- 'host|h:s' => \$Param->{host},
- 'user|u:s' => \$Param->{user},
- 'password|p:s' => \$Param->{password},
- 'printerror|e:s' => \$Param->{PrintError},
- 'socket|s:s' => \$Param->{socket},
- 'help|h' => \$help,
- )) {
- ShowOptions();
- exit(0);
-}
-if (defined ($help)) {
- ShowOptions();
- exit(0);
-}
-
- print "explain_log provided by http://www.mobile.de\n";
- print "=========== ================================\n";
-
- $Param->{UpdateCount} = 0;
- $Param->{SelectCount} = 0;
- $Param->{IdxUseCount} = 0;
- $Param->{LineCount} = 0;
-
- $Param->{Init} = 0;
- $Param->{Field} = 0;
- $Param->{Refresh} = 0;
- $Param->{QueryCount} = 0;
- $Param->{Statistics} =0;
-
- $Param->{Query} = undef;
- $Param->{ALL} = undef ;
- $Param->{Comment} = undef ;
-
- @{$Param->{Rows}} = (qw|possible_keys key type|);
-
- if ($Param->{ViewDate}) {
- $Param->{View} = 0;
- }
- else {
- $Param->{View} = 1;
- }
-
- #print "Date=$Param->{ViewDate}, host=$Param->{host}, user=$Param->{user}, password=$Param->{password}\n";
-
- $Param->{dbh}=DBI->connect("DBI:mysql:host=$Param->{host}".($Param->{socket}?";mysql_socket=$Param->{socket}":""),$Param->{user},$Param->{password},{PrintError=>0});
- if (DBI::err()) {
- print "Error: " . DBI::errstr() . "\n";
- }
- else {
- $Param->{Start} = time;
- while(<>) {
- $Param->{LineCount} ++ ;
-
- if ($Param->{ViewDate} ) {
- if (m/^(\d{6})\s+\d{1,2}:\d\d:\d\d\s.*$/) { # get date
- #print "# $1 #\n";
- if ($1 == $Param->{ViewDate}) {
- $Param->{View} = 1;
- }
- else {
- $Param->{View} = 0;
- }
- }
- }
- if ($Param->{View} ) {
- #print "->>>$_";
-
- if (m/^(\d{6}\s+\d{1,2}:\d\d:\d\d\s+|\s+)(\d+)\s+Connect.+\s+on\s+(.*)$/i) { # get connection ID($2) and database($3)
- #print "C-$1--$2--$3------\n";
- RunQuery($Param);
- if (defined $3) {
- $Param->{CID}->{$2} = $3 ;
- #print "DB:$Param->{CID}->{$2} .. $2 .. $3 \n";
- }
- }
-
- elsif (m/^(\d{6}\s+\d{1,2}:\d\d:\d\d\s+|\s+)(\d+)\s+Connect.+$/i) { # get connection ID($2) and database($3)
- #print "\n <<<<<<<<<<<<<<<<<<----------------------------<<<<<<<<<<<<<<<< \n";
- #print "Connect \n";
- RunQuery($Param);
- }
- elsif (m/^(\d{6}\s+\d{1,2}:\d\d:\d\d\s+|\s+)(\d+)\s+Change user .*\s+on\s+(.*)$/i) { # get connection ID($2) and database($3)
- #print "C-$1--$2--$3------\n";
- RunQuery($Param);
- if (defined $3) {
- $Param->{CID}->{$2} = $3 ;
- #print "DB:$Param->{CID}->{$2} .. $2 .. $3 \n";
- }
- }
-
- elsif (m/^(\d{6}\s+\d{1,2}:\d\d:\d\d\s+|\s+)(\d+)\s+Quit\s+$/i) { # remove connection ID($2) and querystring
- #print "Q-$1--$2--------\n";
- RunQuery($Param);
- delete $Param->{CID}->{$2} ;
- }
-
- elsif (m/^(\d{6}\s+\d{1,2}:\d\d:\d\d\s+|\s+)(\d+)\s+Query\s+(select.+)$/i) { # get connection ID($2) and querystring
- #print "S1-$1--$2--$3------\n";
- RunQuery($Param);
- unless ($Param->{CID}->{$2}) {
- #print "Error: No Database for Handle: $2 found\n";
- }
- else {
- $Param->{DB}=$Param->{CID}->{$2};
-
- my $s = "$3";
- $s =~ s/from\s/from $Param->{DB}./i;
- $Param->{Query}="EXPLAIN $s";
-
- #$s =~ m/from\s+(\w+[.]\w+)/i;
- #$Param->{tab} =$1;
- #print "-- $Param->{tab} -- $s --\n";
- }
- }
-
- elsif (m/^(\d{6}\s+\d{1,2}:\d\d:\d\d\s+|\s+)(\d+)\s+Query\s+(update.+)$/i) { # get connection ID($2) and querystring
- #print "S2--$1--$2--$3------\n";
- RunQuery($Param);
- unless ($Param->{CID}->{$2}) {
- #print "Error: No Database for Handle: $2 found\n";
- }
- else {
- $Param->{DB}=$Param->{CID}->{$2};
-
- my $ud = $3;
- $ud =~ m/^update\s+(\w+).+(where.+)$/i;
- $Param->{Query} ="EXPLAIN SELECT * FROM $1 $2";
- $Param->{Query} =~ s/from\s/from $Param->{DB}./i;
-
- #$Param->{Query} =~ m/from\s+(\w+[.]\w+)/i;
- #$Param->{tab} =$1;
- }
- }
-
- elsif (m/^(\d{6}\s+\d{1,2}:\d\d:\d\d\s+|\s+)(\d+)\s+Statistics\s+(.*)$/i) { # get connection ID($2) and info?
- $Param->{Statistics} ++;
- #print "Statistics--$1--$2--$3------\n";
- RunQuery($Param);
- }
- elsif (m/^(\d{6}\s+\d{1,2}:\d\d:\d\d\s+|\s+)(\d+)\s+Query\s+(.+)$/i) { # get connection ID($2)
- $Param->{QueryCount} ++;
- #print "Query-NULL $3\n";
- RunQuery($Param);
- }
- elsif (m/^(\d{6}\s+\d{1,2}:\d\d:\d\d\s+|\s+)(\d+)\s+Refresh\s+(.+)$/i) { # get connection ID($2)
- $Param->{Refresh} ++;
- #print "Refresh\n";
- RunQuery($Param);
- }
- elsif (m/^(\d{6}\s+\d{1,2}:\d\d:\d\d\s+|\s+)(\d+)\s+Init\s+(.+)$/i) { # get connection ID($2)
- $Param->{Init} ++;
- #print "Init $3\n";
- RunQuery($Param);
- }
- elsif (m/^(\d{6}\s+\d{1,2}:\d\d:\d\d\s+|\s+)(\d+)\s+Field\s+(.+)$/i) { # get connection ID($2)
- $Param->{Field} ++;
- #print "Field $3\n";
- RunQuery($Param);
- }
-
- elsif (m/^\s+(.+)$/ ) { # command could be some lines ...
- #print "multi-lined ($1)\n";
- my ($A)=$1;
- $A =~ s/\-\-.*//;
-
- $Param->{Query} .= " $A";
- #print "multi-lined ($A)<<$Param->{Query}>>\n";
- }
-
-
- }
-
- }
-
- $Param->{dbh}->disconnect();
-
- if (1 == 0) {
- print "\nunclosed handles----------------------------------------\n";
- my $count=0;
- foreach (sort keys %{$Param->{CID}}) {
- print "$count | $_ : $Param->{CID}->{$_} \n";
- $count ++;
- }
- }
-
- print "\nIndex usage ------------------------------------\n";
- foreach my $t (sort keys %{$Param->{Data}}) {
- print "\nTable\t$t: ---\n";
- foreach my $k (sort keys %{$Param->{Data}->{$t}}) {
- print " count\t$k:\n";
- my %h = %{$Param->{Data}->{$t}->{$k}};
- foreach (sort {$h{$a} <=> $h{$b}} keys %h) {
- print " $Param->{Data}->{$t}->{$k}->{$_}\t$_\n";
- }
- }
- }
-
- $Param->{AllCount}=0;
- print "\nQueries causing table scans -------------------\n\n";
- foreach (@{$Param->{ALL}}) {
- $Param->{AllCount} ++;
- print "$_\n";
- }
- print "Sum: $Param->{AllCount} table scans\n";
-
- print "\nSummary ---------------------------------------\n\n";
- print "Select: \t$Param->{SelectCount} queries\n";
- print "Update: \t$Param->{UpdateCount} queries\n";
- print "\n";
-
- print "Init: \t$Param->{Init} times\n";
- print "Field: \t$Param->{Field} times\n";
- print "Refresh: \t$Param->{Refresh} times\n";
- print "Query: \t$Param->{QueryCount} times\n";
- print "Statistics:\t$Param->{Statistics} times\n";
- print "\n";
-
- print "Logfile: \t$Param->{LineCount} lines\n";
- print "Started: \t".localtime($Param->{Start})."\n";
- print "Finished: \t".localtime(time)."\n";
-
- }
-
-
-###########################################################################
-#
-#
-#
-sub RunQuery {
- my $Param = shift ;
-
- if (defined $Param->{Query}) {
- if (defined $Param->{DB} ) {
-
- $Param->{Query} =~ m/from\s+(\w+[.]\w+|\w+)/i;
- $Param->{tab} =$1;
- #print "||$Param->{tab} -- $Param->{Query}\n";
-
- my $sth=$Param->{dbh}->prepare("USE $Param->{DB}");
- if (DBI::err()) {
- if ($Param->{PrintError}) {print "Error: ".DBI::errstr()."\n";}
- }
- else {
- $sth->execute();
- if (DBI::err()) {
- if ($Param->{PrintError}) {print "Error: ".DBI::errstr()."\n";}
- }
- else {
- $sth->finish();
-
- $sth=$Param->{dbh}->prepare($Param->{Query});
- if (DBI::err()) {
- if ($Param->{PrintError}) {print "Error: ".DBI::errstr()."\n";}
- }
- else {
- #print "$Param->{Query}\n";
- $sth->execute();
- if (DBI::err()) {
- if ($Param->{PrintError}) {print "[$Param->{LineCount}]<<$Param->{Query}>>\n";}
- if ($Param->{PrintError}) {print "Error: ".DBI::errstr()."\n";}
- }
- else {
- my $row = undef;
- while ($row = $sth->fetchrow_hashref()) {
- $Param->{SelectCount} ++;
-
- if (defined $row->{Comment}) {
- push (@{$Param->{Comment}}, "$row->{Comment}; $_; $Param->{DB}; $Param->{Query}");
- }
- foreach (@{$Param->{Rows}}) {
- if (defined $row->{$_}) {
- #if (($_ eq 'type' ) and ($row->{$_} eq 'ALL')) {
- if ($row->{type} eq 'ALL') {
- push (@{$Param->{ALL}}, "$Param->{Query}");
- #print ">> $row->{$_} $_ $Param->{DB} $Param->{Query}\n";
- }
- $Param->{IdxUseCount} ++;
- $Param->{Data}->{$Param->{tab}}->{$_}->{$row->{$_}} ++;
- }
- }
- }
- }
- }
- }
- }
- $sth->finish();
- }
- $Param->{Query} = undef ;
- }
-}
-
-###########################################################################
-#
-#
-#
-sub ShowOptions {
- print <<EOF;
-Usage: $0 [OPTIONS] < LOGFILE
-
---help, -h
- Display this help message
---date=YYMMDD, -d=YYMMDD
- Select entries from the log only for the given date
---host=HOSTNAME, -h=HOSTNAME
- Connect to the MySQL server on the given host
---user=USERNAME, -u=USERNAME
- The MySQL username to use when connecting to the server
---password=PASSWORD, -p=PASSWORD
- The password to use when connecting to the server
---socket=SOCKET, -s=SOCKET
- The socket file to use when connecting to the server
---printerror=1, -e 1
- Enable error output
-
-mysql_explain_log reads its standard input for query log contents. It
-uses EXPLAIN to analyze SELECT statements found in the input. UPDATE
-statements are rewritten to SELECT statements and also analyzed with
-EXPLAIN. mysql_explain_log then displays a summary of its results.
-Results are printed to the standard output.
-EOF
-}
-
-1;
-
-__END__
-
-=pod
-
-=head1 NAME
-
-mysql_explain_log
-
-Feed a mysqld general query logfile (created with mysqld --log) back
-into mysql and collect statistics about index usage with EXPLAIN.
-
-=head1 DISCUSSION
-
-To optimize your indexes, you must know which ones are actually used
-and what kind of queries are causing table scans. This may not be easy,
-especially if you are generating your queries dynamically and you have
-a huge number of queries being executed.
-
-Use this tool to take a look at the effects of your real life queries.
-Then add indexes to avoid table scans and remove indexes that aren't used.
-
-=head1 USAGE
-
-mysql_explain_log [--date=YYMMDD] --host=dbhost] [--user=dbuser] [--password=dbpw] [--socket=/path/to/socket] [--printerror=1] < logfile
-
---help, -h
- Display this help message
---date=YYMMDD, -d=YYMMDD
- Select entries from the log only for the given date
---host=HOSTNAME, -h=HOSTNAME
- Connect to the MySQL server on the given host
---user=USERNAME, -u=USERNAME
- The MySQL username to use when connecting to the server
---password=PASSWORD, -p=PASSWORD
- The password to use when connecting to the server
---socket=SOCKET, -s=SOCKET
- The socket file to use when connecting to the server
---printerror=1, -e 1
- Enable error output
-
-=head1 EXAMPLE
-
-mysql_explain_log --host=localhost --user=foo --password=bar < /var/lib/mysql/mobile.log
-
-=head1 AUTHORS
-
- Stefan Nitz
- Jan Willamowius <jan@willamowius.de>, http://www.willamowius.de
- Dennis Haney <davh@davh.dk> (Added socket support)
-
-=head1 SEE ALSO
-
-mysql documentation
-
-=cut
diff --git a/scripts/mysql_install_db.sh b/scripts/mysql_install_db.sh
index bc887c83088..20b7973cb4e 100644
--- a/scripts/mysql_install_db.sh
+++ b/scripts/mysql_install_db.sh
@@ -19,7 +19,9 @@
# All unrecognized arguments to this script are passed to mysqld.
basedir=""
-ldata=""
+builddir=""
+ldata="@localstatedir@"
+langdir=""
srcdir=""
args=""
@@ -37,22 +39,25 @@ usage()
cat <<EOF
Usage: $0 [OPTIONS]
--basedir=path The path to the MySQL installation directory.
+ --builddir=path If using --srcdir with out-of-directory builds, you
+ will need to set this to the location of the build
+ directory where built files reside.
--cross-bootstrap For internal use. Used when building the MySQL system
tables on a different host than the target.
--datadir=path The path to the MySQL data directory.
--force Causes mysql_install_db to run even if DNS does not
work. In that case, grant table entries that normally
use hostnames will use IP addresses.
- --ldata=path The path to the MySQL data directory.
+ --ldata=path The path to the MySQL data directory. Same as --datadir.
--rpm For internal use. This option is used by RPM files
during the MySQL installation process.
--skip-name-resolve Use IP addresses rather than hostnames when creating
grant table entries. This option can be useful if
your DNS does not work.
- --srcdir=path For internal use. The directory under which
- mysql_install_db looks for support files such as the
- error message file and the file for popoulating the
- help tables.
+ --srcdir=path The path to the MySQL source directory. This option
+ uses the compiled binaries and support files within the
+ source tree, useful for if you don't want to install
+ MySQL yet and just want to create the system tables.
--user=user_name The login username to use for running mysqld. Files
and directories created by mysqld will be owned by this
user. You must be root to use this option. By default
@@ -95,13 +100,14 @@ parse_arguments()
case "$arg" in
--force) force=1 ;;
--basedir=*) basedir=`parse_arg "$arg"` ;;
+ --builddir=*) builddir=`parse_arg "$arg"` ;;
--srcdir=*) srcdir=`parse_arg "$arg"` ;;
--ldata=*|--datadir=*) ldata=`parse_arg "$arg"` ;;
--user=*)
# Note that the user will be passed to mysqld so that it runs
# as 'user' (crucial e.g. if log-bin=/some_other_path/
# where a chown of datadir won't help)
- user=`parse_arg "$arg"` ;;
+ user=`parse_arg "$arg"` ;;
--skip-name-resolve) ip_only=1 ;;
--verbose) verbose=1 ;; # Obsolete
--rpm) in_rpm=1 ;;
@@ -119,7 +125,7 @@ parse_arguments()
# the install package. See top-level 'dist-hook' make target.
#
# --windows is a deprecated alias
- cross_bootstrap=1 ;;
+ cross_bootstrap=1 ;;
*)
if test -n "$pick_args"
@@ -163,13 +169,31 @@ find_in_basedir()
done
}
-missing_in_basedir()
+cannot_find_file()
{
- echo "FATAL ERROR: Could not find $* inside --basedir"
echo
- echo "When using --basedir you must point either into a MySQL binary"
- echo "distribution directory or a compiled tree previously populated"
- echo "by 'make install'"
+ echo "FATAL ERROR: Could not find $1"
+
+ shift
+ if test $# -ne 0
+ then
+ echo
+ echo "The following directories were searched:"
+ echo
+ for dir in "$@"
+ do
+ echo " $dir"
+ done
+ fi
+
+ echo
+ echo "If you compiled from source, you need to run 'make install' to"
+ echo "copy the software into the correct location ready for operation."
+ echo
+ echo "If you are using a binary release, you must either be at the top"
+ echo "level of the extracted archive, or pass the --basedir option"
+ echo "pointing to that location."
+ echo
}
# Ok, let's go. We first need to parse arguments which are required by
@@ -177,27 +201,42 @@ missing_in_basedir()
# the command line to add any extra bits that we need.
parse_arguments PICK-ARGS-FROM-ARGV "$@"
-# We can now find my_print_defaults, either in the supplied --basedir
-# location or in the installed area.
-if test -n "$basedir"
+#
+# We can now find my_print_defaults. This script supports:
+#
+# --srcdir=path pointing to compiled source tree
+# --basedir=path pointing to installed binary location
+#
+# or default to compiled-in locations.
+#
+if test -n "$srcdir" && test -n "$basedir"
+then
+ echo "ERROR: Specify either --basedir or --srcdir, not both."
+ exit 1
+fi
+if test -n "$srcdir"
+then
+ if test -z "$builddir"
+ then
+ builddir="$srcdir"
+ fi
+ print_defaults="$builddir/extra/my_print_defaults"
+elif test -n "$basedir"
then
print_defaults=`find_in_basedir my_print_defaults bin extra`
- if test ! -x "$print_defaults"
+ if test -z "$print_defaults"
then
- missing_in_basedir my_print_defaults
+ cannot_find_file my_print_defaults $basedir/bin $basedir/extra
exit 1
fi
else
print_defaults="@bindir@/my_print_defaults"
- if test ! -x "$print_defaults"
- then
- echo "FATAL ERROR: Could not find $print_defaults"
- echo
- echo "If you are using a binary release, you must run this script from"
- echo "within the directory the archive extracted into. If you compiled"
- echo "MySQL yourself you must run 'make install' first."
- exit 1
- fi
+fi
+
+if test ! -x "$print_defaults"
+then
+ cannot_find_file "$print_defaults"
+ exit 1
fi
# Now we can get arguments from the groups [mysqld] and [mysql_install_db]
@@ -205,45 +244,49 @@ fi
parse_arguments `$print_defaults $defaults mysqld mysql_install_db`
parse_arguments PICK-ARGS-FROM-ARGV "$@"
-# Path to MySQL installation directory
-if test -z "$basedir"
+# Configure paths to support files
+if test -n "$srcdir"
then
+ basedir="$builddir"
+ bindir="$basedir/client"
+ extra_bindir="$basedir/extra"
+ mysqld="$basedir/sql/mysqld"
+ langdir="$srcdir/sql/share/english"
+ pkgdatadir="$srcdir/scripts"
+ scriptdir="$srcdir/scripts"
+elif test -n "$basedir"
+then
+ bindir="$basedir/bin"
+ extra_bindir="$bindir"
+ mysqld=`find_in_basedir mysqld libexec sbin bin`
+ if test -z "$mysqld"
+ then
+ cannot_find_file mysqld $basedir/libexec $basedir/sbin $basedir/bin
+ exit 1
+ fi
+ langdir=`find_in_basedir --dir errmsg.sys share/english share/mysql/english`
+ if test -z "$langdir"
+ then
+ cannot_find_file errmsg.sys $basedir/share/english $basedir/share/mysql/english
+ exit 1
+ fi
+ pkgdatadir=`find_in_basedir --dir fill_help_tables.sql share share/mysql`
+ if test -z "$pkgdatadir"
+ then
+ cannot_find_file fill_help_tables.sql $basedir/share $basedir/share/mysql
+ exit 1
+ fi
+ scriptdir="$basedir/scripts"
+else
basedir="@prefix@"
bindir="@bindir@"
+ extra_bindir="$bindir"
mysqld="@libexecdir@/mysqld"
pkgdatadir="@pkgdatadir@"
-else
- bindir="$basedir/bin"
- # We set up bootstrap-specific paths later, so skip this for now
- if test "$cross_bootstrap" -eq 0
- then
- pkgdatadir=`find_in_basedir --dir fill_help_tables.sql share share/mysql`
- if test -z "$pkgdatadir"
- then
- missing_in_basedir fill_help_tables.sql
- exit 1
- fi
- mysqld=`find_in_basedir mysqld libexec sbin bin`
- if test ! -x "$mysqld"
- then
- missing_in_basedir mysqld
- exit 1
- fi
- fi
-fi
-
-# Path to data directory
-if test -z "$ldata"
-then
- ldata="@localstatedir@"
-fi
-
-# Set up paths to SQL scripts required for bootstrap and ensure they exist.
-if test -n "$srcdir"
-then
- pkgdatadir="$srcdir/scripts"
+ scriptdir="@scriptdir@"
fi
+# Set up paths to SQL scripts required for bootstrap
fill_help_tables="$pkgdatadir/fill_help_tables.sql"
create_system_tables="$pkgdatadir/mysql_system_tables.sql"
fill_system_tables="$pkgdatadir/mysql_system_tables_data.sql"
@@ -252,29 +295,25 @@ for f in $fill_help_tables $create_system_tables $fill_system_tables
do
if test ! -f "$f"
then
- echo "FATAL ERROR: Could not find SQL file '$f'"
+ cannot_find_file "$f"
exit 1
fi
done
-# Set up bootstrap-specific paths
-if test "$cross_bootstrap" -eq 1
+if test ! -x "$mysqld"
then
- mysqld="./sql/mysqld"
- if test -n "$srcdir" -a -f "$srcdir/sql/share/english/errmsg.sys"
- then
- mysqld_opt="--language=$srcdir/sql/share/english"
- else
- mysqld_opt="--language=./sql/share/english"
- fi
+ cannot_find_file "$mysqld"
+ exit 1
fi
-# Make sure mysqld is available in default location (--basedir option is
-# already tested above).
-if test ! -x "$mysqld"
+if test -n "$langdir"
then
- echo "FATAL ERROR: $mysqld not found!"
- exit 1
+ if test ! -f "$langdir/errmsg.sys"
+ then
+ cannot_find_file "$langdir/errmsg.sys"
+ exit 1
+ fi
+ mysqld_opt="--language=$langdir"
fi
# Try to determine the hostname
@@ -283,14 +322,14 @@ hostname=`@HOSTNAME@`
# Check if hostname is valid
if test "$cross_bootstrap" -eq 0 -a "$in_rpm" -eq 0 -a "$force" -eq 0
then
- resolved=`$bindir/resolveip $hostname 2>&1`
- if [ $? -ne 0 ]
+ resolved=`$extra_bindir/resolveip $hostname 2>&1`
+ if test $? -ne 0
then
- resolved=`$bindir/resolveip localhost 2>&1`
- if [ $? -ne 0 ]
+ resolved=`$extra_bindir/resolveip localhost 2>&1`
+ if test $? -ne 0
then
echo "Neither host '$hostname' nor 'localhost' could be looked up with"
- echo "$bindir/resolveip"
+ echo "$extra_bindir/resolveip"
echo "Please configure the 'hostname' command to return a correct"
echo "hostname."
echo "If you want to solve this at a later stage, restart this script"
@@ -311,7 +350,7 @@ then
hostname=`echo "$resolved" | awk '/ /{print $6}'`
fi
-# Create database directories mysql & test
+# Create database directories
for dir in $ldata $ldata/mysql $ldata/test
do
if test ! -d $dir
@@ -340,94 +379,100 @@ else
filter_cmd_line="cat"
fi
-# Peform the install of system tables
+# Configure mysqld command line
mysqld_bootstrap="${MYSQLD_BOOTSTRAP-$mysqld}"
mysqld_install_cmd_line="$mysqld_bootstrap $defaults $mysqld_opt --bootstrap \
- --basedir=$basedir --datadir=$ldata --skip-innodb --skip-bdb \
- --skip-ndbcluster $args --max_allowed_packet=8M --net_buffer_length=16K"
+ --basedir=$basedir --datadir=$ldata --log-warnings=0 --loose-skip-innodb \
+ --loose-skip-ndbcluster $args --max_allowed_packet=8M \
+ --default-storage-engine=myisam \
+ --net_buffer_length=16K"
-# Pipe mysql_system_tables.sql to "mysqld --bootstrap"
+# Create the system and help tables by passing them to "mysqld --bootstrap"
s_echo "Installing MySQL system tables..."
if { echo "use mysql;"; cat $create_system_tables $fill_system_tables; } | eval "$filter_cmd_line" | $mysqld_install_cmd_line > /dev/null
then
s_echo "OK"
+else
+ echo
+ echo "Installation of system tables failed! Examine the logs in"
+ echo "$ldata for more information."
+ echo
+ echo "You can try to start the mysqld daemon with:"
+ echo
+ echo " shell> $mysqld --skip-grant &"
+ echo
+ echo "and use the command line tool $bindir/mysql"
+ echo "to connect to the mysql database and look at the grant tables:"
+ echo
+ echo " shell> $bindir/mysql -u root mysql"
+ echo " mysql> show tables"
+ echo
+ echo "Try 'mysqld --help' if you have problems with paths. Using --log"
+ echo "gives you a log in $ldata that may be helpful."
+ echo
+ echo "The latest information about MySQL is available on the web at"
+ echo "http://www.mysql.com/. Please consult the MySQL manual section"
+ echo "'Problems running mysql_install_db', and the manual section that"
+ echo "describes problems on your OS. Another information source are the"
+ echo "MySQL email archives available at http://lists.mysql.com/."
+ echo
+ echo "Please check all of the above before mailing us! And remember, if"
+ echo "you do mail us, you MUST use the $scriptdir/mysqlbug script!"
+ echo
+ exit 1
+fi
- s_echo "Filling help tables..."
- # Pipe fill_help_tables.sql to "mysqld --bootstrap"
- if { echo "use mysql;"; cat $fill_help_tables; } | $mysqld_install_cmd_line > /dev/null
- then
- s_echo "OK"
- else
- echo
- echo "WARNING: HELP FILES ARE NOT COMPLETELY INSTALLED!"
- echo "The \"HELP\" command might not work properly"
- echo
- fi
+s_echo "Filling help tables..."
+if { echo "use mysql;"; cat $fill_help_tables; } | $mysqld_install_cmd_line > /dev/null
+then
+ s_echo "OK"
+else
+ echo
+ echo "WARNING: HELP FILES ARE NOT COMPLETELY INSTALLED!"
+ echo "The \"HELP\" command might not work properly."
+fi
+# Don't output verbose information if running inside bootstrap or using
+# --srcdir for testing. In such cases, there's no end user looking at
+# the screen.
+if test "$cross_bootstrap" -eq 0 && test -z "$srcdir"
+then
s_echo
s_echo "To start mysqld at boot time you have to copy"
s_echo "support-files/mysql.server to the right place for your system"
- s_echo
- if test "$cross_bootstrap" -eq 0
+ echo
+ echo "PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !"
+ echo "To do so, start the server, then issue the following commands:"
+ echo
+ echo "$bindir/mysqladmin -u root password 'new-password'"
+ echo "$bindir/mysqladmin -u root -h $hostname password 'new-password'"
+ echo
+ echo "Alternatively you can run:"
+ echo "$bindir/mysql_secure_installation"
+ echo
+ echo "which will also give you the option of removing the test"
+ echo "databases and anonymous user created by default. This is"
+ echo "strongly recommended for production servers."
+ echo
+ echo "See the manual for more instructions."
+
+ if test "$in_rpm" -eq 0
then
- # This is not a true installation on a running system. The end user must
- # set a password after installing the data files on the real host system.
- # At this point, there is no end user, so it does not make sense to print
- # this reminder.
- echo "PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !"
- echo "To do so, start the server, then issue the following commands:"
- echo "$bindir/mysqladmin -u root password 'new-password'"
- echo "$bindir/mysqladmin -u root -h $hostname password 'new-password'"
echo
- echo "Alternatively you can run:"
- echo "$bindir/mysql_secure_installation"
+ echo "You can start the MySQL daemon with:"
+ echo "cd $basedir ; $bindir/mysqld_safe &"
echo
- echo "which will also give you the option of removing the test"
- echo "databases and anonymous user created by default. This is"
- echo "strongly recommended for production servers."
- echo
- echo "See the manual for more instructions."
- echo
-
- if test "$in_rpm" -eq 0
- then
- echo "You can start the MySQL daemon with:"
- echo "cd @prefix@ ; $bindir/mysqld_safe &"
- echo
- echo "You can test the MySQL daemon with mysql-test-run.pl"
- echo "cd mysql-test ; perl mysql-test-run.pl"
- echo
- fi
- echo "Please report any problems with the @scriptdir@/mysqlbug script!"
- echo
- echo "The latest information about MySQL is available on the web at"
- echo "http://www.mysql.com"
- echo "Support MySQL by buying support/licenses at http://shop.mysql.com"
+ echo "You can test the MySQL daemon with mysql-test-run.pl"
+ echo "cd $basedir/mysql-test ; perl mysql-test-run.pl"
fi
- exit 0
-else
- echo "Installation of system tables failed!"
- echo
- echo "Examine the logs in $ldata for more information."
- echo "You can try to start the mysqld daemon with:"
- echo "$mysqld --skip-grant &"
- echo "and use the command line tool"
- echo "$bindir/mysql to connect to the mysql"
- echo "database and look at the grant tables:"
+
echo
- echo "shell> $bindir/mysql -u root mysql"
- echo "mysql> show tables"
+ echo "Please report any problems with the $scriptdir/mysqlbug script!"
echo
- echo "Try 'mysqld --help' if you have problems with paths. Using --log"
- echo "gives you a log in $ldata that may be helpful."
+ echo "The latest information about MySQL is available at http://www.mysql.com/"
+ echo "Support MySQL by buying support/licenses from http://shop.mysql.com/"
echo
- echo "The latest information about MySQL is available on the web at"
- echo "http://www.mysql.com"
- echo "Please consult the MySQL manual section: 'Problems running mysql_install_db',"
- echo "and the manual section that describes problems on your OS."
- echo "Another information source is the MySQL email archive."
- echo "Please check all of the above before mailing us!"
- echo "And if you do mail us, you MUST use the @scriptdir@/mysqlbug script!"
- exit 1
fi
+
+exit 0
diff --git a/scripts/mysql_prepare_privilege_tables_for_5.sql b/scripts/mysql_prepare_privilege_tables_for_5.sql
deleted file mode 100644
index a9b6d43aee0..00000000000
--- a/scripts/mysql_prepare_privilege_tables_for_5.sql
+++ /dev/null
@@ -1,53 +0,0 @@
-
-use mysql;
-
---
--- merging `host` table and `db`
---
-
-UPDATE IGNORE host SET Host='%' WHERE Host='';
-DELETE FROM host WHERE Host='';
-
-INSERT IGNORE INTO db (User, Host, Select_priv, Insert_priv, Update_priv,
- Delete_priv, Create_priv, Drop_priv, Grant_priv, References_priv,
- Index_priv, Alter_priv, Create_tmp_table_priv, Lock_tables_priv)
- SELECT d.User, h.Host,
- (d.Select_priv = 'Y' || h.Select_priv = 'Y') + 1,
- (d.Insert_priv = 'Y' || h.Select_priv = 'Y') + 1,
- (d.Update_priv = 'Y' || h.Update_priv = 'Y') + 1,
- (d.Delete_priv = 'Y' || h.Delete_priv = 'Y') + 1,
- (d.Create_priv = 'Y' || h.Create_priv = 'Y') + 1,
- (d.Drop_priv = 'Y' || h.Drop_priv = 'Y') + 1,
- (d.Grant_priv = 'Y' || h.Grant_priv = 'Y') + 1,
- (d.References_priv = 'Y' || h.References_priv = 'Y') + 1,
- (d.Index_priv = 'Y' || h.Index_priv = 'Y') + 1,
- (d.Alter_priv = 'Y' || h.Alter_priv = 'Y') + 1,
- (d.Create_tmp_table_priv = 'Y' || h.Create_tmp_table_priv = 'Y') + 1,
- (d.Lock_tables_priv = 'Y' || h.Lock_tables_priv = 'Y') + 1
- FROM db d, host h WHERE d.Host = '';
-
-UPDATE IGNORE db SET Host='%' WHERE Host = '';
-DELETE FROM db WHERE Host='';
-
-TRUNCATE TABLE host;
-
---
--- Adding missing users to `user` table
---
--- note that invalid password causes the user to be skipped during the
--- load of grand tables (at mysqld startup) thus three following inserts
--- do not affect anything
-
-INSERT IGNORE user (User, Host, Password) SELECT User, Host, "*" FROM db;
-INSERT IGNORE user (User, Host, Password) SELECT User, Host, "*" FROM tables_priv;
-INSERT IGNORE user (User, Host, Password) SELECT User, Host, "*" FROM columns_priv;
-
-SELECT DISTINCT
-"There are user accounts with the username 'PUBLIC'. In the SQL-1999
-(or later) standard this name is reserved for PUBLIC role and can
-not be used as a valid user name. Consider renaming these accounts before
-upgrading to MySQL-5.0.
-These accounts are:" x
-FROM user WHERE user='PUBLIC';
-SELECT CONCAT(user,'@',host) FROM user WHERE user='PUBLIC';
-
diff --git a/scripts/mysql_setpermission.sh b/scripts/mysql_setpermission.sh
index 9b49345175a..5fa6b969e39 100644
--- a/scripts/mysql_setpermission.sh
+++ b/scripts/mysql_setpermission.sh
@@ -257,7 +257,7 @@ sub addall {
$sth = $dbh->do("GRANT ALL ON $db.* TO \'$user\'\@\'$host\' IDENTIFIED BY \'$pass\'") || die $dbh->errstr;
} elsif ($todo == 7) {
# all privileges set to N
- $sth = $dbh->do("REVOKE ALL ON *.* FROM \'$user\'\@\'$host\'") || die $dbh->errstr;
+ $sth = $dbh->do("REVOKE ALL ON $db.* FROM \'$user\'\@\'$host\'") || die $dbh->errstr;
}
}
$dbh->do("FLUSH PRIVILEGES") || print STDERR "Can't flush privileges\n";
diff --git a/scripts/mysql_system_tables.sql b/scripts/mysql_system_tables.sql
index 31eb205eed0..67e18517915 100644
--- a/scripts/mysql_system_tables.sql
+++ b/scripts/mysql_system_tables.sql
@@ -5,15 +5,15 @@
set sql_mode='';
set storage_engine=myisam;
-CREATE TABLE IF NOT EXISTS db ( Host char(60) binary DEFAULT '' NOT NULL, Db char(64) binary DEFAULT '' NOT NULL, User char(16) binary DEFAULT '' NOT NULL, Select_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Insert_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Update_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Delete_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Drop_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Grant_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, References_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Index_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Alter_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_tmp_table_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Lock_tables_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_view_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Show_view_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_routine_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Alter_routine_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Execute_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, PRIMARY KEY Host (Host,Db,User), KEY User (User) ) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='Database privileges';
+CREATE TABLE IF NOT EXISTS db ( Host char(60) binary DEFAULT '' NOT NULL, Db char(64) binary DEFAULT '' NOT NULL, User char(16) binary DEFAULT '' NOT NULL, Select_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Insert_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Update_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Delete_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Drop_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Grant_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, References_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Index_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Alter_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_tmp_table_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Lock_tables_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_view_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Show_view_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_routine_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Alter_routine_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Execute_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Event_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Trigger_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, PRIMARY KEY Host (Host,Db,User), KEY User (User) ) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='Database privileges';
-- Remember for later if db table already existed
set @had_db_table= @@warning_count != 0;
-CREATE TABLE IF NOT EXISTS host ( Host char(60) binary DEFAULT '' NOT NULL, Db char(64) binary DEFAULT '' NOT NULL, Select_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Insert_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Update_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Delete_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Drop_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Grant_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, References_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Index_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Alter_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_tmp_table_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Lock_tables_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_view_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Show_view_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_routine_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Alter_routine_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Execute_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, PRIMARY KEY Host (Host,Db) ) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='Host privileges; Merged with database privileges';
+CREATE TABLE IF NOT EXISTS host ( Host char(60) binary DEFAULT '' NOT NULL, Db char(64) binary DEFAULT '' NOT NULL, Select_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Insert_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Update_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Delete_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Drop_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Grant_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, References_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Index_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Alter_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_tmp_table_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Lock_tables_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_view_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Show_view_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_routine_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Alter_routine_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Execute_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Trigger_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, PRIMARY KEY Host (Host,Db) ) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='Host privileges; Merged with database privileges';
-CREATE TABLE IF NOT EXISTS user ( Host char(60) binary DEFAULT '' NOT NULL, User char(16) binary DEFAULT '' NOT NULL, Password char(41) character set latin1 collate latin1_bin DEFAULT '' NOT NULL, Select_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Insert_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Update_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Delete_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Drop_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Reload_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Shutdown_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Process_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, File_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Grant_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, References_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Index_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Alter_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Show_db_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Super_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_tmp_table_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Lock_tables_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Execute_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Repl_slave_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Repl_client_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_view_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Show_view_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_routine_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Alter_routine_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_user_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, ssl_type enum('','ANY','X509', 'SPECIFIED') COLLATE utf8_general_ci DEFAULT '' NOT NULL, ssl_cipher BLOB NOT NULL, x509_issuer BLOB NOT NULL, x509_subject BLOB NOT NULL, max_questions int(11) unsigned DEFAULT 0 NOT NULL, max_updates int(11) unsigned DEFAULT 0 NOT NULL, max_connections int(11) unsigned DEFAULT 0 NOT NULL, max_user_connections int(11) unsigned DEFAULT 0 NOT NULL, PRIMARY KEY Host (Host,User) ) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='Users and global privileges';
+CREATE TABLE IF NOT EXISTS user ( Host char(60) binary DEFAULT '' NOT NULL, User char(16) binary DEFAULT '' NOT NULL, Password char(41) character set latin1 collate latin1_bin DEFAULT '' NOT NULL, Select_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Insert_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Update_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Delete_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Drop_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Reload_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Shutdown_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Process_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, File_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Grant_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, References_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Index_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Alter_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Show_db_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Super_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_tmp_table_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Lock_tables_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Execute_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Repl_slave_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Repl_client_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_view_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Show_view_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_routine_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Alter_routine_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_user_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Event_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Trigger_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, ssl_type enum('','ANY','X509', 'SPECIFIED') COLLATE utf8_general_ci DEFAULT '' NOT NULL, ssl_cipher BLOB NOT NULL, x509_issuer BLOB NOT NULL, x509_subject BLOB NOT NULL, max_questions int(11) unsigned DEFAULT 0 NOT NULL, max_updates int(11) unsigned DEFAULT 0 NOT NULL, max_connections int(11) unsigned DEFAULT 0 NOT NULL, max_user_connections int(11) unsigned DEFAULT 0 NOT NULL, PRIMARY KEY Host (Host,User) ) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='Users and global privileges';
-- Remember for later if user table already existed
set @had_user_table= @@warning_count != 0;
@@ -22,7 +22,13 @@ set @had_user_table= @@warning_count != 0;
CREATE TABLE IF NOT EXISTS func ( name char(64) binary DEFAULT '' NOT NULL, ret tinyint(1) DEFAULT '0' NOT NULL, dl char(128) DEFAULT '' NOT NULL, type enum ('function','aggregate') COLLATE utf8_general_ci NOT NULL, PRIMARY KEY (name) ) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='User defined functions';
-CREATE TABLE IF NOT EXISTS tables_priv ( Host char(60) binary DEFAULT '' NOT NULL, Db char(64) binary DEFAULT '' NOT NULL, User char(16) binary DEFAULT '' NOT NULL, Table_name char(64) binary DEFAULT '' NOT NULL, Grantor char(77) DEFAULT '' NOT NULL, Timestamp timestamp(14), Table_priv set('Select','Insert','Update','Delete','Create','Drop','Grant','References','Index','Alter','Create View','Show view') COLLATE utf8_general_ci DEFAULT '' NOT NULL, Column_priv set('Select','Insert','Update','References') COLLATE utf8_general_ci DEFAULT '' NOT NULL, PRIMARY KEY (Host,Db,User,Table_name), KEY Grantor (Grantor) ) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='Table privileges';
+CREATE TABLE IF NOT EXISTS plugin ( name char(64) binary DEFAULT '' NOT NULL, dl char(128) DEFAULT '' NOT NULL, PRIMARY KEY (name) ) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='MySQL plugins';
+
+
+CREATE TABLE IF NOT EXISTS servers ( Server_name char(64) NOT NULL DEFAULT '', Host char(64) NOT NULL DEFAULT '', Db char(64) NOT NULL DEFAULT '', Username char(64) NOT NULL DEFAULT '', Password char(64) NOT NULL DEFAULT '', Port INT(4) NOT NULL DEFAULT '0', Socket char(64) NOT NULL DEFAULT '', Wrapper char(64) NOT NULL DEFAULT '', Owner char(64) NOT NULL DEFAULT '', PRIMARY KEY (Server_name)) CHARACTER SET utf8 comment='MySQL Foreign Servers table';
+
+
+CREATE TABLE IF NOT EXISTS tables_priv ( Host char(60) binary DEFAULT '' NOT NULL, Db char(64) binary DEFAULT '' NOT NULL, User char(16) binary DEFAULT '' NOT NULL, Table_name char(64) binary DEFAULT '' NOT NULL, Grantor char(77) DEFAULT '' NOT NULL, Timestamp timestamp(14), Table_priv set('Select','Insert','Update','Delete','Create','Drop','Grant','References','Index','Alter','Create View','Show view','Trigger') COLLATE utf8_general_ci DEFAULT '' NOT NULL, Column_priv set('Select','Insert','Update','References') COLLATE utf8_general_ci DEFAULT '' NOT NULL, PRIMARY KEY (Host,Db,User,Table_name), KEY Grantor (Grantor) ) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='Table privileges';
CREATE TABLE IF NOT EXISTS columns_priv ( Host char(60) binary DEFAULT '' NOT NULL, Db char(64) binary DEFAULT '' NOT NULL, User char(16) binary DEFAULT '' NOT NULL, Table_name char(64) binary DEFAULT '' NOT NULL, Column_name char(64) binary DEFAULT '' NOT NULL, Timestamp timestamp(14), Column_priv set('Select','Insert','Update','References') COLLATE utf8_general_ci DEFAULT '' NOT NULL, PRIMARY KEY (Host,Db,User,Table_name,Column_name) ) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='Column privileges';
@@ -54,8 +60,28 @@ CREATE TABLE IF NOT EXISTS time_zone_transition_type ( Time_zone_id int unsign
CREATE TABLE IF NOT EXISTS time_zone_leap_second ( Transition_time bigint signed NOT NULL, Correction int signed NOT NULL, PRIMARY KEY TranTime (Transition_time) ) engine=MyISAM CHARACTER SET utf8 comment='Leap seconds information for time zones';
-CREATE TABLE IF NOT EXISTS proc ( db char(64) collate utf8_bin DEFAULT '' NOT NULL, name char(64) DEFAULT '' NOT NULL, type enum('FUNCTION','PROCEDURE') NOT NULL, specific_name char(64) DEFAULT '' NOT NULL, language enum('SQL') DEFAULT 'SQL' NOT NULL, sql_data_access enum('CONTAINS_SQL', 'NO_SQL', 'READS_SQL_DATA', 'MODIFIES_SQL_DATA' ) DEFAULT 'CONTAINS_SQL' NOT NULL, is_deterministic enum('YES','NO') DEFAULT 'NO' NOT NULL, security_type enum('INVOKER','DEFINER') DEFAULT 'DEFINER' NOT NULL, param_list blob NOT NULL, returns char(64) DEFAULT '' NOT NULL, body longblob NOT NULL, definer char(77) collate utf8_bin DEFAULT '' NOT NULL, created timestamp, modified timestamp, sql_mode set( 'REAL_AS_FLOAT', 'PIPES_AS_CONCAT', 'ANSI_QUOTES', 'IGNORE_SPACE', 'NOT_USED', 'ONLY_FULL_GROUP_BY', 'NO_UNSIGNED_SUBTRACTION', 'NO_DIR_IN_CREATE', 'POSTGRESQL', 'ORACLE', 'MSSQL', 'DB2', 'MAXDB', 'NO_KEY_OPTIONS', 'NO_TABLE_OPTIONS', 'NO_FIELD_OPTIONS', 'MYSQL323', 'MYSQL40', 'ANSI', 'NO_AUTO_VALUE_ON_ZERO', 'NO_BACKSLASH_ESCAPES', 'STRICT_TRANS_TABLES', 'STRICT_ALL_TABLES', 'NO_ZERO_IN_DATE', 'NO_ZERO_DATE', 'INVALID_DATES', 'ERROR_FOR_DIVISION_BY_ZERO', 'TRADITIONAL', 'NO_AUTO_CREATE_USER', 'HIGH_NOT_PRECEDENCE' ) DEFAULT '' NOT NULL, comment char(64) collate utf8_bin DEFAULT '' NOT NULL, PRIMARY KEY (db,name,type) ) engine=MyISAM character set utf8 comment='Stored Procedures';
-
+CREATE TABLE IF NOT EXISTS proc (db char(64) collate utf8_bin DEFAULT '' NOT NULL, name char(64) DEFAULT '' NOT NULL, type enum('FUNCTION','PROCEDURE') NOT NULL, specific_name char(64) DEFAULT '' NOT NULL, language enum('SQL') DEFAULT 'SQL' NOT NULL, sql_data_access enum( 'CONTAINS_SQL', 'NO_SQL', 'READS_SQL_DATA', 'MODIFIES_SQL_DATA') DEFAULT 'CONTAINS_SQL' NOT NULL, is_deterministic enum('YES','NO') DEFAULT 'NO' NOT NULL, security_type enum('INVOKER','DEFINER') DEFAULT 'DEFINER' NOT NULL, param_list blob NOT NULL, returns longblob DEFAULT '' NOT NULL, body longblob NOT NULL, definer char(77) collate utf8_bin DEFAULT '' NOT NULL, created timestamp, modified timestamp, sql_mode set( 'REAL_AS_FLOAT', 'PIPES_AS_CONCAT', 'ANSI_QUOTES', 'IGNORE_SPACE', 'NOT_USED', 'ONLY_FULL_GROUP_BY', 'NO_UNSIGNED_SUBTRACTION', 'NO_DIR_IN_CREATE', 'POSTGRESQL', 'ORACLE', 'MSSQL', 'DB2', 'MAXDB', 'NO_KEY_OPTIONS', 'NO_TABLE_OPTIONS', 'NO_FIELD_OPTIONS', 'MYSQL323', 'MYSQL40', 'ANSI', 'NO_AUTO_VALUE_ON_ZERO', 'NO_BACKSLASH_ESCAPES', 'STRICT_TRANS_TABLES', 'STRICT_ALL_TABLES', 'NO_ZERO_IN_DATE', 'NO_ZERO_DATE', 'INVALID_DATES', 'ERROR_FOR_DIVISION_BY_ZERO', 'TRADITIONAL', 'NO_AUTO_CREATE_USER', 'HIGH_NOT_PRECEDENCE', 'NO_ENGINE_SUBSTITUTION', 'PAD_CHAR_TO_FULL_LENGTH') DEFAULT '' NOT NULL, comment char(64) collate utf8_bin DEFAULT '' NOT NULL, character_set_client char(32) collate utf8_bin, collation_connection char(32) collate utf8_bin, db_collation char(32) collate utf8_bin, body_utf8 longblob, PRIMARY KEY (db,name,type)) engine=MyISAM character set utf8 comment='Stored Procedures';
CREATE TABLE IF NOT EXISTS procs_priv ( Host char(60) binary DEFAULT '' NOT NULL, Db char(64) binary DEFAULT '' NOT NULL, User char(16) binary DEFAULT '' NOT NULL, Routine_name char(64) binary DEFAULT '' NOT NULL, Routine_type enum('FUNCTION','PROCEDURE') NOT NULL, Grantor char(77) DEFAULT '' NOT NULL, Proc_priv set('Execute','Alter Routine','Grant') COLLATE utf8_general_ci DEFAULT '' NOT NULL, Timestamp timestamp(14), PRIMARY KEY (Host,Db,User,Routine_name,Routine_type), KEY Grantor (Grantor) ) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='Procedure privileges';
+-- Create general_log if CSV is enabled.
+
+SET @str = IF (@@have_csv = 'YES', 'CREATE TABLE IF NOT EXISTS general_log (event_time TIMESTAMP NOT NULL, user_host MEDIUMTEXT NOT NULL, thread_id INTEGER NOT NULL, server_id INTEGER UNSIGNED NOT NULL, command_type VARCHAR(64) NOT NULL, argument MEDIUMTEXT NOT NULL) engine=CSV CHARACTER SET utf8 comment="General log"', 'SET @dummy = 0');
+
+PREPARE stmt FROM @str;
+EXECUTE stmt;
+DROP PREPARE stmt;
+
+-- Create slow_log if CSV is enabled.
+
+SET @str = IF (@@have_csv = 'YES', 'CREATE TABLE IF NOT EXISTS slow_log (start_time TIMESTAMP NOT NULL, user_host MEDIUMTEXT NOT NULL, query_time TIME NOT NULL, lock_time TIME NOT NULL, rows_sent INTEGER NOT NULL, rows_examined INTEGER NOT NULL, db VARCHAR(512) NOT NULL, last_insert_id INTEGER NOT NULL, insert_id INTEGER NOT NULL, server_id INTEGER UNSIGNED NOT NULL, sql_text MEDIUMTEXT NOT NULL) engine=CSV CHARACTER SET utf8 comment="Slow log"', 'SET @dummy = 0');
+
+PREPARE stmt FROM @str;
+EXECUTE stmt;
+DROP PREPARE stmt;
+
+CREATE TABLE IF NOT EXISTS event ( db char(64) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL default '', name char(64) CHARACTER SET utf8 NOT NULL default '', body longblob NOT NULL, definer char(77) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL default '', execute_at DATETIME default NULL, interval_value int(11) default NULL, interval_field ENUM('YEAR','QUARTER','MONTH','DAY','HOUR','MINUTE','WEEK','SECOND','MICROSECOND','YEAR_MONTH','DAY_HOUR','DAY_MINUTE','DAY_SECOND','HOUR_MINUTE','HOUR_SECOND','MINUTE_SECOND','DAY_MICROSECOND','HOUR_MICROSECOND','MINUTE_MICROSECOND','SECOND_MICROSECOND') default NULL, created TIMESTAMP NOT NULL, modified TIMESTAMP NOT NULL, last_executed DATETIME default NULL, starts DATETIME default NULL, ends DATETIME default NULL, status ENUM('ENABLED','DISABLED','SLAVESIDE_DISABLED') NOT NULL default 'ENABLED', on_completion ENUM('DROP','PRESERVE') NOT NULL default 'DROP', sql_mode set('REAL_AS_FLOAT','PIPES_AS_CONCAT','ANSI_QUOTES','IGNORE_SPACE','NOT_USED','ONLY_FULL_GROUP_BY','NO_UNSIGNED_SUBTRACTION','NO_DIR_IN_CREATE','POSTGRESQL','ORACLE','MSSQL','DB2','MAXDB','NO_KEY_OPTIONS','NO_TABLE_OPTIONS','NO_FIELD_OPTIONS','MYSQL323','MYSQL40','ANSI','NO_AUTO_VALUE_ON_ZERO','NO_BACKSLASH_ESCAPES','STRICT_TRANS_TABLES','STRICT_ALL_TABLES','NO_ZERO_IN_DATE','NO_ZERO_DATE','INVALID_DATES','ERROR_FOR_DIVISION_BY_ZERO','TRADITIONAL','NO_AUTO_CREATE_USER','HIGH_NOT_PRECEDENCE','NO_ENGINE_SUBSTITUTION','PAD_CHAR_TO_FULL_LENGTH') DEFAULT '' NOT NULL, comment char(64) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL default '', originator INTEGER UNSIGNED NOT NULL, time_zone char(64) CHARACTER SET latin1 NOT NULL DEFAULT 'SYSTEM', character_set_client char(32) collate utf8_bin, collation_connection char(32) collate utf8_bin, db_collation char(32) collate utf8_bin, body_utf8 longblob, PRIMARY KEY (db, name) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT 'Events';
+
+
+CREATE TABLE IF NOT EXISTS ndb_binlog_index (Position BIGINT UNSIGNED NOT NULL, File VARCHAR(255) NOT NULL, epoch BIGINT UNSIGNED NOT NULL, inserts BIGINT UNSIGNED NOT NULL, updates BIGINT UNSIGNED NOT NULL, deletes BIGINT UNSIGNED NOT NULL, schemaops BIGINT UNSIGNED NOT NULL, PRIMARY KEY(epoch)) ENGINE=MYISAM;
+
diff --git a/scripts/mysql_system_tables_data.sql b/scripts/mysql_system_tables_data.sql
index b70a8a13f6e..9a3a3f7bb84 100644
--- a/scripts/mysql_system_tables_data.sql
+++ b/scripts/mysql_system_tables_data.sql
@@ -11,8 +11,8 @@ set @current_hostname= @@hostname;
-- Fill "db" table with default grants for anyone to
-- access database 'test' and 'test_%' if "db" table didn't exist
CREATE TEMPORARY TABLE tmp_db LIKE db;
-INSERT INTO tmp_db VALUES ('%','test','','Y','Y','Y','Y','Y','Y','N','Y','Y','Y','Y','Y','Y','Y','Y','N','N');
-INSERT INTO tmp_db VALUES ('%','test\_%','','Y','Y','Y','Y','Y','Y','N','Y','Y','Y','Y','Y','Y','Y','Y','N','N');
+INSERT INTO tmp_db VALUES ('%','test','','Y','Y','Y','Y','Y','Y','N','Y','Y','Y','Y','Y','Y','Y','Y','N','N','Y','Y');
+INSERT INTO tmp_db VALUES ('%','test\_%','','Y','Y','Y','Y','Y','Y','N','Y','Y','Y','Y','Y','Y','Y','Y','N','N','Y','Y');
INSERT INTO db SELECT * FROM tmp_db WHERE @had_db_table=0;
DROP TABLE tmp_db;
@@ -20,9 +20,10 @@ DROP TABLE tmp_db;
-- Fill "users" table with default users allowing root access
-- from local machine if "users" table didn't exist before
CREATE TEMPORARY TABLE tmp_user LIKE user;
-INSERT INTO tmp_user VALUES ('localhost','root','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0,0);
-REPLACE INTO tmp_user SELECT @current_hostname,'root','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0,0 FROM dual WHERE LOWER( @current_hostname) != 'localhost';
-REPLACE INTO tmp_user VALUES ('127.0.0.1','root','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0,0);
+set @current_hostname= @@hostname;
+INSERT INTO tmp_user VALUES ('localhost','root','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0,0);
+REPLACE INTO tmp_user SELECT @current_hostname,'root','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0,0 FROM dual WHERE LOWER( @current_hostname) != 'localhost';
+REPLACE INTO tmp_user VALUES ('127.0.0.1','root','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0,0);
INSERT INTO tmp_user (host,user) VALUES ('localhost','');
INSERT INTO tmp_user (host,user) SELECT @current_hostname,'' FROM dual WHERE LOWER(@current_hostname ) != 'localhost';
INSERT INTO user SELECT * FROM tmp_user WHERE @had_user_table=0;
diff --git a/scripts/mysql_system_tables_fix.sql b/scripts/mysql_system_tables_fix.sql
index c8334339b32..a6497f57f0a 100644
--- a/scripts/mysql_system_tables_fix.sql
+++ b/scripts/mysql_system_tables_fix.sql
@@ -41,7 +41,6 @@ ALTER TABLE user MODIFY ssl_type enum('','ANY','X509', 'SPECIFIED') NOT NULL;
#
# tables_priv
#
-
ALTER TABLE tables_priv
ADD KEY Grantor (Grantor);
@@ -66,8 +65,9 @@ ALTER TABLE tables_priv
#
# columns_priv
#
-
+#
# Name change of Type -> Column_priv from MySQL 3.22.12
+#
ALTER TABLE columns_priv
CHANGE Type Column_priv set('Select','Insert','Update','References')
COLLATE utf8_general_ci DEFAULT '' NOT NULL;
@@ -131,8 +131,8 @@ ALTER TABLE db
ADD Create_tmp_table_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,
ADD Lock_tables_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL;
ALTER TABLE host
-ADD Create_tmp_table_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,
-ADD Lock_tables_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL;
+ADD Create_tmp_table_priv enum('N','Y') DEFAULT 'N' NOT NULL,
+ADD Lock_tables_priv enum('N','Y') DEFAULT 'N' NOT NULL;
alter table user change max_questions max_questions int(11) unsigned DEFAULT 0 NOT NULL;
@@ -216,6 +216,20 @@ ALTER TABLE func
MODIFY type enum ('function','aggregate') COLLATE utf8_general_ci NOT NULL;
#
+# Modify log tables.
+#
+
+SET @old_log_state = @@global.general_log;
+SET GLOBAL general_log = 'OFF';
+ALTER TABLE general_log MODIFY COLUMN server_id INTEGER UNSIGNED NOT NULL;
+SET GLOBAL general_log = @old_log_state;
+
+SET @old_log_state = @@global.slow_query_log;
+SET GLOBAL slow_query_log = 'OFF';
+ALTER TABLE slow_log MODIFY COLUMN server_id INTEGER UNSIGNED NOT NULL;
+SET GLOBAL slow_query_log = @old_log_state;
+
+#
# Detect whether we had Create_view_priv
#
SET @hadCreateViewPriv:=0;
@@ -343,7 +357,8 @@ ALTER TABLE proc MODIFY name char(64) DEFAULT '' NOT NULL,
'READS_SQL_DATA',
'MODIFIES_SQL_DATA'
) DEFAULT 'CONTAINS_SQL' NOT NULL,
- MODIFY body longblob DEFAULT '' NOT NULL,
+ MODIFY body longblob NOT NULL,
+ MODIFY returns longblob NOT NULL,
MODIFY sql_mode
set('REAL_AS_FLOAT',
'PIPES_AS_CONCAT',
@@ -374,7 +389,9 @@ ALTER TABLE proc MODIFY name char(64) DEFAULT '' NOT NULL,
'ERROR_FOR_DIVISION_BY_ZERO',
'TRADITIONAL',
'NO_AUTO_CREATE_USER',
- 'HIGH_NOT_PRECEDENCE'
+ 'HIGH_NOT_PRECEDENCE',
+ 'NO_ENGINE_SUBSTITUTION',
+ 'PAD_CHAR_TO_FULL_LENGTH'
) DEFAULT '' NOT NULL,
DEFAULT CHARACTER SET utf8;
@@ -388,6 +405,138 @@ ALTER TABLE proc MODIFY db
MODIFY comment
char(64) collate utf8_bin DEFAULT '' NOT NULL;
+ALTER TABLE proc ADD character_set_client
+ char(32) collate utf8_bin DEFAULT NULL
+ AFTER comment;
+ALTER TABLE proc MODIFY character_set_client
+ char(32) collate utf8_bin DEFAULT NULL;
+
+ALTER TABLE proc ADD collation_connection
+ char(32) collate utf8_bin DEFAULT NULL
+ AFTER character_set_client;
+ALTER TABLE proc MODIFY collation_connection
+ char(32) collate utf8_bin DEFAULT NULL;
+
+ALTER TABLE proc ADD db_collation
+ char(32) collate utf8_bin DEFAULT NULL
+ AFTER collation_connection;
+ALTER TABLE proc MODIFY db_collation
+ char(32) collate utf8_bin DEFAULT NULL;
+
+ALTER TABLE proc ADD body_utf8 longblob DEFAULT NULL
+ AFTER db_collation;
+ALTER TABLE proc MODIFY body_utf8 longblob DEFAULT NULL;
+
+
+#
+# EVENT privilege
+#
+SET @hadEventPriv := 0;
+SELECT @hadEventPriv :=1 FROM user WHERE Event_priv LIKE '%';
+
+ALTER TABLE user add Event_priv enum('N','Y') character set utf8 DEFAULT 'N' NOT NULL AFTER Create_user_priv;
+ALTER TABLE user MODIFY Event_priv enum('N','Y') character set utf8 DEFAULT 'N' NOT NULL AFTER Create_user_priv;
+
+UPDATE user SET Event_priv=Super_priv WHERE @hadEventPriv = 0;
+
+ALTER TABLE db add Event_priv enum('N','Y') character set utf8 DEFAULT 'N' NOT NULL;
+ALTER TABLE db MODIFY Event_priv enum('N','Y') character set utf8 DEFAULT 'N' NOT NULL;
+
+#
+# EVENT table
+#
+ALTER TABLE event DROP PRIMARY KEY;
+ALTER TABLE event ADD PRIMARY KEY(db, name);
+# Add sql_mode column just in case.
+ALTER TABLE event ADD sql_mode set ('NOT_USED') AFTER on_completion;
+# Update list of sql_mode values.
+ALTER TABLE event MODIFY sql_mode
+ set('REAL_AS_FLOAT',
+ 'PIPES_AS_CONCAT',
+ 'ANSI_QUOTES',
+ 'IGNORE_SPACE',
+ 'NOT_USED',
+ 'ONLY_FULL_GROUP_BY',
+ 'NO_UNSIGNED_SUBTRACTION',
+ 'NO_DIR_IN_CREATE',
+ 'POSTGRESQL',
+ 'ORACLE',
+ 'MSSQL',
+ 'DB2',
+ 'MAXDB',
+ 'NO_KEY_OPTIONS',
+ 'NO_TABLE_OPTIONS',
+ 'NO_FIELD_OPTIONS',
+ 'MYSQL323',
+ 'MYSQL40',
+ 'ANSI',
+ 'NO_AUTO_VALUE_ON_ZERO',
+ 'NO_BACKSLASH_ESCAPES',
+ 'STRICT_TRANS_TABLES',
+ 'STRICT_ALL_TABLES',
+ 'NO_ZERO_IN_DATE',
+ 'NO_ZERO_DATE',
+ 'INVALID_DATES',
+ 'ERROR_FOR_DIVISION_BY_ZERO',
+ 'TRADITIONAL',
+ 'NO_AUTO_CREATE_USER',
+ 'HIGH_NOT_PRECEDENCE',
+ 'NO_ENGINE_SUBSTITUTION',
+ 'PAD_CHAR_TO_FULL_LENGTH'
+ ) DEFAULT '' NOT NULL AFTER on_completion;
+ALTER TABLE event MODIFY name char(64) CHARACTER SET utf8 NOT NULL default '';
+
+ALTER TABLE event MODIFY COLUMN originator INT UNSIGNED NOT NULL;
+ALTER TABLE event ADD COLUMN originator INT UNSIGNED NOT NULL AFTER comment;
+
+ALTER TABLE event MODIFY COLUMN status ENUM('ENABLED','DISABLED','SLAVESIDE_DISABLED') NOT NULL default 'ENABLED';
+
+ALTER TABLE event ADD COLUMN time_zone char(64) CHARACTER SET latin1
+ NOT NULL DEFAULT 'SYSTEM' AFTER originator;
+
+ALTER TABLE event ADD character_set_client
+ char(32) collate utf8_bin DEFAULT NULL
+ AFTER time_zone;
+ALTER TABLE event MODIFY character_set_client
+ char(32) collate utf8_bin DEFAULT NULL;
+
+ALTER TABLE event ADD collation_connection
+ char(32) collate utf8_bin DEFAULT NULL
+ AFTER character_set_client;
+ALTER TABLE event MODIFY collation_connection
+ char(32) collate utf8_bin DEFAULT NULL;
+
+ALTER TABLE event ADD db_collation
+ char(32) collate utf8_bin DEFAULT NULL
+ AFTER collation_connection;
+ALTER TABLE event MODIFY db_collation
+ char(32) collate utf8_bin DEFAULT NULL;
+
+ALTER TABLE event ADD body_utf8 longblob DEFAULT NULL
+ AFTER db_collation;
+ALTER TABLE event MODIFY body_utf8 longblob DEFAULT NULL;
+
+
+#
+# TRIGGER privilege
+#
+
+SET @hadTriggerPriv := 0;
+SELECT @hadTriggerPriv :=1 FROM user WHERE Trigger_priv LIKE '%';
+
+ALTER TABLE user ADD Trigger_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL AFTER Event_priv;
+ALTER TABLE user MODIFY Trigger_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL AFTER Event_priv;
+
+ALTER TABLE host ADD Trigger_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL;
+ALTER TABLE host MODIFY Trigger_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL;
+
+ALTER TABLE db ADD Trigger_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL;
+ALTER TABLE db MODIFY Trigger_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL;
+
+ALTER TABLE tables_priv MODIFY Table_priv set('Select','Insert','Update','Delete','Create','Drop','Grant','References','Index','Alter','Create View','Show view','Trigger') COLLATE utf8_general_ci DEFAULT '' NOT NULL;
+
+UPDATE user SET Trigger_priv=Super_priv WHERE @hadTriggerPriv = 0;
+
# Activate the new, possible modified privilege tables
# This should not be needed, but gives us some extra testing that the above
# changes was correct
diff --git a/scripts/mysql_tableinfo.sh b/scripts/mysql_tableinfo.sh
deleted file mode 100644
index c90c410ca78..00000000000
--- a/scripts/mysql_tableinfo.sh
+++ /dev/null
@@ -1,494 +0,0 @@
-#!/usr/bin/perl
-
-use strict;
-use Getopt::Long;
-use DBI;
-
-=head1 NAME
-
-WARNING: MySQL versions 5.0 and above feature the INFORMATION_SCHEMA
-pseudo-database which contains always up-to-date metadata information
-about all tables. So instead of using this script one can now
-simply query the INFORMATION_SCHEMA.SCHEMATA, INFORMATION_SCHEMA.TABLES,
-INFORMATION_SCHEMA.COLUMNS, INFORMATION_SCHEMA.STATISTICS pseudo-tables.
-Please see the MySQL manual for more information about INFORMATION_SCHEMA.
-This script will be removed from the MySQL distribution in version 5.1.
-
-mysql_tableinfo - creates and populates information tables with
-the output of SHOW DATABASES, SHOW TABLES (or SHOW TABLE STATUS),
-SHOW COLUMNS and SHOW INDEX.
-
-This is version 1.1.
-
-=head1 SYNOPSIS
-
- mysql_tableinfo [OPTIONS] database_to_write [database_like_wild] [table_like_wild]
-
- Do not backquote (``) database_to_write,
- and do not quote ('') database_like_wild or table_like_wild
-
- Examples:
-
- mysql_tableinfo info
-
- mysql_tableinfo info this_db
-
- mysql_tableinfo info %a% b%
-
- mysql_tableinfo info --clear-only
-
- mysql_tableinfo info --col --idx --table-status
-
-=cut
-
-# Documentation continued at end of file
-
-
-sub usage {
- die @_,"\nExecute 'perldoc $0' for documentation\n";
-}
-
-my %opt = (
- 'user' => scalar getpwuid($>),
- 'host' => "localhost",
- 'prefix' => "", #to avoid 'use of uninitialized value...'
-);
-Getopt::Long::Configure(qw(no_ignore_case)); # disambuguate -p and -P
-GetOptions( \%opt,
- "help",
- "user|u=s",
- "password|p=s",
- "host|h=s",
- "port|P=s",
- "socket|S=s",
- "tbl-status",
- "col",
- "idx",
- "clear",
- "clear-only",
- "prefix=s",
- "quiet|q",
-) or usage("Invalid option");
-
-if (!$opt{'quiet'})
- {
- print <<EOF
-WARNING: MySQL versions 5.0 and above feature the INFORMATION_SCHEMA
-pseudo-database which contains always up-to-date metadata information
-about all tables. So instead of using this script one can now
-simply query the INFORMATION_SCHEMA.SCHEMATA, INFORMATION_SCHEMA.TABLES,
-INFORMATION_SCHEMA.COLUMNS, INFORMATION_SCHEMA.STATISTICS pseudo-tables.
-Please see the MySQL manual for more information about INFORMATION_SCHEMA.
-This script will be removed from the MySQL distribution in version 5.1.
-EOF
- }
-
-if ($opt{'help'}) {usage();}
-
-my ($db_to_write,$db_like_wild,$tbl_like_wild);
-if (@ARGV==0)
-{
- usage("Not enough arguments");
-}
-$db_to_write="`$ARGV[0]`"; shift @ARGV;
-$db_like_wild=($ARGV[0])?$ARGV[0]:"%"; shift @ARGV;
-$tbl_like_wild=($ARGV[0])?$ARGV[0]:"%"; shift @ARGV;
-if (@ARGV>0) { usage("Too many arguments"); }
-
-$0 = $1 if $0 =~ m:/([^/]+)$:;
-
-my $info_db="`".$opt{'prefix'}."db`";
-my $info_tbl="`".$opt{'prefix'}."tbl".
- (($opt{'tbl-status'})?"_status":"")."`";
-my $info_col="`".$opt{'prefix'}."col`";
-my $info_idx="`".$opt{'prefix'}."idx`";
-
-
-# --- connect to the database ---
-
-my $dsn = ";host=$opt{'host'}";
-$dsn .= ";port=$opt{'port'}" if $opt{'port'};
-$dsn .= ";mysql_socket=$opt{'socket'}" if $opt{'socket'};
-
-my $dbh = DBI->connect("dbi:mysql:$dsn;mysql_read_default_group=perl",
- $opt{'user'}, $opt{'password'},
-{
- RaiseError => 1,
- PrintError => 0,
- AutoCommit => 1,
-});
-
-$db_like_wild=$dbh->quote($db_like_wild);
-$tbl_like_wild=$dbh->quote($tbl_like_wild);
-
-#Ask
-
-if (!$opt{'quiet'})
-{
- print "\n!! This program is going to do:\n\n";
- print "**DROP** TABLE ...\n" if ($opt{'clear'} or $opt{'clear-only'});
- print "**DELETE** FROM ... WHERE `Database` LIKE $db_like_wild AND `Table` LIKE $tbl_like_wild
-**INSERT** INTO ...
-
-on the following tables :\n";
-
- foreach (($info_db, $info_tbl),
- (($opt{'col'})?$info_col:()),
- (($opt{'idx'})?$info_idx:()))
- {
- print(" $db_to_write.$_\n");
- }
- print "\nContinue (you can skip this confirmation step with --quiet) ? (y|n) [n]";
- if (<STDIN> !~ /^\s*y\s*$/i)
- {
- print "Nothing done!\n";exit;
- }
-}
-
-if ($opt{'clear'} or $opt{'clear-only'})
-{
-#do not drop the $db_to_write database !
- foreach (($info_db, $info_tbl),
- (($opt{'col'})?$info_col:()),
- (($opt{'idx'})?$info_idx:()))
- {
- $dbh->do("DROP TABLE IF EXISTS $db_to_write.$_");
- }
- if ($opt{'clear-only'})
- {
- print "Wrote to database $db_to_write .\n" unless ($opt{'quiet'});
- exit;
- }
-}
-
-
-my %sth;
-my %extra_col_desc;
-my %row;
-my %done_create_table;
-
-#create the $db_to_write database
-$dbh->do("CREATE DATABASE IF NOT EXISTS $db_to_write");
-$dbh->do("USE $db_to_write");
-
-#get databases
-$sth{'db'}=$dbh->prepare("SHOW DATABASES LIKE $db_like_wild");
-$sth{'db'}->execute;
-
-#create $info_db which will receive info about databases.
-#Ensure that the first column to be called "Database" (as SHOW DATABASES LIKE
-#returns a varying
-#column name (of the form "Database (%...)") which is not suitable)
-$extra_col_desc{'db'}=do_create_table("db",$info_db,undef,"`Database`");
-#we'll remember the type of the `Database` column (as returned by
-#SHOW DATABASES), which we will need when creating the next tables.
-
-#clear out-of-date info from this table
-$dbh->do("DELETE FROM $info_db WHERE `Database` LIKE $db_like_wild");
-
-
-while ($row{'db'}=$sth{'db'}->fetchrow_arrayref) #go through all databases
-{
-
-#insert the database name
- $dbh->do("INSERT INTO $info_db VALUES("
- .join(',' , ( map $dbh->quote($_), @{$row{'db'}} ) ).")" );
-
-#for each database, get tables
-
- $sth{'tbl'}=$dbh->prepare("SHOW TABLE"
- .( ($opt{'tbl-status'}) ?
- " STATUS"
- : "S" )
- ." from `$row{'db'}->[0]` LIKE $tbl_like_wild");
- $sth{'tbl'}->execute;
- unless ($done_create_table{$info_tbl})
-
-#tables must be created only once, and out-of-date info must be
-#cleared once
- {
- $done_create_table{$info_tbl}=1;
- $extra_col_desc{'tbl'}=
- do_create_table("tbl",$info_tbl,
-#add an extra column (database name) at the left
-#and ensure that the table name will be called "Table"
-#(this is unncessesary with
-#SHOW TABLE STATUS, but necessary with SHOW TABLES (which returns a column
-#named "Tables_in_..."))
- "`Database` ".$extra_col_desc{'db'},"`Table`");
- $dbh->do("DELETE FROM $info_tbl WHERE `Database` LIKE $db_like_wild AND `Table` LIKE $tbl_like_wild");
- }
-
- while ($row{'tbl'}=$sth{'tbl'}->fetchrow_arrayref)
- {
- $dbh->do("INSERT INTO $info_tbl VALUES("
- .$dbh->quote($row{'db'}->[0]).","
- .join(',' , ( map $dbh->quote($_), @{$row{'tbl'}} ) ).")");
-
-#for each table, get columns...
-
- if ($opt{'col'})
- {
- $sth{'col'}=$dbh->prepare("SHOW COLUMNS FROM `$row{'tbl'}->[0]` FROM `$row{'db'}->[0]`");
- $sth{'col'}->execute;
- unless ($done_create_table{$info_col})
- {
- $done_create_table{$info_col}=1;
- do_create_table("col",$info_col,
- "`Database` ".$extra_col_desc{'db'}.","
- ."`Table` ".$extra_col_desc{'tbl'}.","
- ."`Seq_in_table` BIGINT(3)");
-#We need to add a sequence number (1 for the first column of the table,
-#2 for the second etc) so that users are able to retrieve columns in order
-#if they want. This is not needed for INDEX
-#(where there is already Seq_in_index)
- $dbh->do("DELETE FROM $info_col WHERE `Database`
- LIKE $db_like_wild
- AND `Table` LIKE $tbl_like_wild");
- }
- my $col_number=0;
- while ($row{'col'}=$sth{'col'}->fetchrow_arrayref)
- {
- $dbh->do("INSERT INTO $info_col VALUES("
- .$dbh->quote($row{'db'}->[0]).","
- .$dbh->quote($row{'tbl'}->[0]).","
- .++$col_number.","
- .join(',' , ( map $dbh->quote($_), @{$row{'col'}} ) ).")");
- }
- }
-
-#and get index.
-
- if ($opt{'idx'})
- {
- $sth{'idx'}=$dbh->prepare("SHOW INDEX FROM `$row{'tbl'}->[0]` FROM `$row{'db'}->[0]`");
- $sth{'idx'}->execute;
- unless ($done_create_table{$info_idx})
- {
- $done_create_table{$info_idx}=1;
- do_create_table("idx",$info_idx,
- "`Database` ".$extra_col_desc{'db'});
- $dbh->do("DELETE FROM $info_idx WHERE `Database`
- LIKE $db_like_wild
- AND `Table` LIKE $tbl_like_wild");
- }
- while ($row{'idx'}=$sth{'idx'}->fetchrow_arrayref)
- {
- $dbh->do("INSERT INTO $info_idx VALUES("
- .$dbh->quote($row{'db'}->[0]).","
- .join(',' , ( map $dbh->quote($_), @{$row{'idx'}} ) ).")");
- }
- }
- }
-}
-
-print "Wrote to database $db_to_write .\n" unless ($opt{'quiet'});
-exit;
-
-
-sub do_create_table
-{
- my ($sth_key,$target_tbl,$extra_col_desc,$first_col_name)=@_;
- my $create_table_query=$extra_col_desc;
- my ($i,$first_col_desc,$col_desc);
-
- for ($i=0;$i<$sth{$sth_key}->{NUM_OF_FIELDS};$i++)
- {
- if ($create_table_query) { $create_table_query.=", "; }
- $col_desc=$sth{$sth_key}->{mysql_type_name}->[$i];
- if ($col_desc =~ /char|int/i)
- {
- $col_desc.="($sth{$sth_key}->{PRECISION}->[$i])";
- }
- elsif ($col_desc =~ /decimal|numeric/i) #(never seen that)
- {
- $col_desc.=
- "($sth{$sth_key}->{PRECISION}->[$i],$sth{$sth_key}->{SCALE}->[$i])";
- }
- elsif ($col_desc !~ /date/i) #date and datetime are OK,
- #no precision or scale for them
- {
- warn "unexpected column type '$col_desc'
-(neither 'char','int','decimal|numeric')
-when creating $target_tbl, hope table creation will go OK\n";
- }
- if ($i==0) {$first_col_desc=$col_desc};
- $create_table_query.=
- ( ($i==0 and $first_col_name) ?
- "$first_col_name " :"`$sth{$sth_key}->{NAME}->[$i]` " )
- .$col_desc;
- }
-if ($create_table_query)
-{
- $dbh->do("CREATE TABLE IF NOT EXISTS $target_tbl ($create_table_query)");
-}
-return $first_col_desc;
-}
-
-__END__
-
-
-=head1 DESCRIPTION
-
-mysql_tableinfo asks a MySQL server information about its
-databases, tables, table columns and index, and stores this
-in tables called `db`, `tbl` (or `tbl_status`), `col`, `idx`
-(with an optional prefix specified with --prefix).
-After that, you can query these information tables, for example
-to build your admin scripts with SQL queries, like
-
-SELECT CONCAT("CHECK TABLE ",`database`,".",`table`," EXTENDED;")
-FROM info.tbl WHERE ... ;
-
-as people usually do with some other RDBMS
-(note: to increase the speed of your queries on the info tables,
-you may add some index on them).
-
-The database_like_wild and table_like_wild instructs the program
-to gather information only about databases and tables
-whose names match these patterns. If the info
-tables already exist, their rows matching the patterns are simply
-deleted and replaced by the new ones. That is,
-old rows not matching the patterns are not touched.
-If the database_like_wild and table_like_wild arguments
-are not specified on the command-line they default to "%".
-
-The program :
-
-- does CREATE DATABASE IF NOT EXISTS database_to_write
-where database_to_write is the database name specified on the command-line.
-
-- does CREATE TABLE IF NOT EXISTS database_to_write.`db`
-
-- fills database_to_write.`db` with the output of
-SHOW DATABASES LIKE database_like_wild
-
-- does CREATE TABLE IF NOT EXISTS database_to_write.`tbl`
-(respectively database_to_write.`tbl_status`
-if the --tbl-status option is on)
-
-- for every found database,
-fills database_to_write.`tbl` (respectively database_to_write.`tbl_status`)
-with the output of
-SHOW TABLES FROM found_db LIKE table_like_wild
-(respectively SHOW TABLE STATUS FROM found_db LIKE table_like_wild)
-
-- if the --col option is on,
- * does CREATE TABLE IF NOT EXISTS database_to_write.`col`
- * for every found table,
- fills database_to_write.`col` with the output of
- SHOW COLUMNS FROM found_tbl FROM found_db
-
-- if the --idx option is on,
- * does CREATE TABLE IF NOT EXISTS database_to_write.`idx`
- * for every found table,
- fills database_to_write.`idx` with the output of
- SHOW INDEX FROM found_tbl FROM found_db
-
-Some options may modify this general scheme (see below).
-
-As mentioned, the contents of the info tables are the output of
-SHOW commands. In fact the contents are slightly more complete :
-
-- the `tbl` (or `tbl_status`) info table
- has an extra column which contains the database name,
-
-- the `col` info table
- has an extra column which contains the table name,
- and an extra column which contains, for each described column,
- the number of this column in the table owning it (this extra column
- is called `Seq_in_table`). `Seq_in_table` makes it possible for you
- to retrieve your columns in sorted order, when you are querying
- the `col` table.
-
-- the `index` info table
- has an extra column which contains the database name.
-
-Caution: info tables contain certain columns (e.g.
-Database, Table, Null...) whose names, as they are MySQL reserved words,
-need to be backquoted (`...`) when used in SQL statements.
-
-Caution: as information fetching and info tables filling happen at the
-same time, info tables may contain inaccurate information about
-themselves.
-
-=head1 OPTIONS
-
-=over 4
-
-=item --clear
-
-Does DROP TABLE on the info tables (only those that the program is
-going to fill, for example if you do not use --col it won't drop
-the `col` table) and processes normally. Does not drop database_to_write.
-
-=item --clear-only
-
-Same as --clear but exits after the DROPs.
-
-=item --col
-
-Adds columns information (into table `col`).
-
-=item --idx
-
-Adds index information (into table `idx`).
-
-=item --prefix prefix
-
-The info tables are named from the concatenation of prefix and,
-respectively, db, tbl (or tbl_status), col, idx. Do not quote ('')
-or backquote (``) prefix.
-
-=item -q, --quiet
-
-Does not warn you about what the script is going to do (DROP TABLE etc)
-and does not ask for a confirmation before starting.
-
-=item --tbl-status
-
-Instead of using SHOW TABLES, uses SHOW TABLE STATUS
-(much more complete information, but slower).
-
-=item --help
-
-Display helpscreen and exit
-
-=item -u, --user=#
-
-user for database login if not current user. Give a user
-who has sufficient privileges (CREATE, ...).
-
-=item -p, --password=#
-
-password to use when connecting to server
-
-=item -h, --host=#
-
-host to connect to
-
-=item -P, --port=#
-
-port to use when connecting to server
-
-=item -S, --socket=#
-
-UNIX domain socket to use when connecting to server
-
-=head1 WARRANTY
-
-This software is free and comes without warranty of any kind.
-
-Patches adding bug fixes, documentation and new features are welcome.
-
-=head1 TO DO
-
-Nothing: starting from MySQL 5.0, this program is replaced by the
-INFORMATION_SCHEMA pseudo-database.
-
-=head1 AUTHOR
-
-2002-06-18 Guilhem Bichot (guilhem.bichot@mines-paris.org)
-
-And all the authors of mysqlhotcopy, which served as a model for
-the structure of the program.
diff --git a/scripts/mysql_upgrade_shell.sh b/scripts/mysql_upgrade_shell.sh
deleted file mode 100644
index 8a24a0d0740..00000000000
--- a/scripts/mysql_upgrade_shell.sh
+++ /dev/null
@@ -1,215 +0,0 @@
-#!/bin/sh
-# Copyright (C) 2002-2003 MySQL AB
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; version 2 of the License.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-
-# Runs mysqlcheck --check-upgrade in case it has not been done on this
-# major MySQL version
-
-# This script should always be run when upgrading from one major version
-# to another (ie: 4.1 -> 5.0 -> 5.1)
-
-#
-# Note that in most cases one have to use '--password' as
-# arguments as these needs to be passed on to the mysqlcheck command
-
-
-user=root
-
-case "$1" in
- --no-defaults|--defaults-file=*|--defaults-extra-file=*)
- defaults="$1"; shift
- ;;
-esac
-
-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
- case "$arg" in
- --basedir=*) MY_BASEDIR_VERSION=`echo "$arg" | sed -e 's/^[^=]*=//'` ;;
- --user=*) user=`echo "$arg" | sed -e 's/^[^=]*=//'` ;;
- --ldata=*|--data=*|--datadir=*) DATADIR=`echo "$arg" | sed -e 's/^[^=]*=//'` ;;
- --force) force=1 ;;
- --verbose) verbose=1 ;;
- --help) help_option=1 ;;
- *)
- if test -n "$pick_args"
- then
- # This sed command makes sure that any special chars are quoted,
- # so the arg gets passed exactly to the server.
- args="$args "`echo "$arg" | sed -e 's,\([^a-zA-Z0-9_.=-]\),\\\\\1,g'`
- fi
- ;;
- esac
- done
-}
-
-#
-# Find where my_print_defaults is
-#
-
-find_my_print_defaults () {
- if test -x ./bin/my_print_defaults
- then
- print_defaults="./bin/my_print_defaults"
- elif test -x ./extra/my_print_defaults
- then
- print_defaults="./extra/my_print_defaults"
- elif test -x @bindir@/my_print_defaults
- then
- print_defaults="@bindir@/my_print_defaults"
- elif test -x @bindir@/mysql_print_defaults
- then
- print_defaults="@bindir@/mysql_print_defaults"
- else
- print_defaults="my_print_defaults"
- fi
-}
-
-find_my_print_defaults
-
-# Get first arguments from the my.cfg file, groups [mysqld] and
-# [mysql_upgrade], and then merge with the command line arguments
-
-args=
-DATADIR=
-bindir=
-MY_BASEDIR_VERSION=
-verbose=0
-force=0
-help_option=0
-
-parse_arguments `$print_defaults $defaults mysqld mysql_upgrade`
-parse_arguments PICK-ARGS-FROM-ARGV "$@"
-
-if test $help_option = 1
-then
- echo "MySQL utility script to upgrade database to the current server version"
- echo ""
- echo "It takes the following arguments:"
- echo " --help Show this help message"
- echo " --basedir Specifies the directory where MySQL is installed"
- echo " --datadir Specifies the data directory"
- echo " --force Mysql_upgrade.info file will be ignored"
- echo " --user Username for server login if not current user"
- echo " --verbose Display more output about the process"
- echo ""
-
- exit 0
-fi
-
-#
-# Try to find where binaries are installed
-#
-
-MY_PWD=`pwd`
-# Check for the directories we would expect from a binary release install
-if test -z "$MY_BASEDIR_VERSION"
-then
- if test -f ./share/mysql/english/errmsg.sys -a -x ./bin/mysqld
- then
- MY_BASEDIR_VERSION=$MY_PWD # Where bin, share and data are
- bindir="$MY_BASEDIR_VERSION/bin"
- # Check for the directories we would expect from a source install
- elif test -f ./share/mysql/english/errmsg.sys -a -x ./libexec/mysqld
- then
- MY_BASEDIR_VERSION=$MY_PWD # Where libexec, share and var are
- bindir="$MY_BASEDIR_VERSION/bin"
-# Since we didn't find anything, used the compiled-in defaults
- else
- MY_BASEDIR_VERSION=@prefix@
- bindir=@bindir@
- fi
-else
- bindir="$MY_BASEDIR_VERSION/bin"
-fi
-
-#
-# Try to find the data directory
-#
-
-if test -z "$DATADIR"
-then
- # Try where the binary installs put it
- if test -d $MY_BASEDIR_VERSION/data/mysql
- then
- DATADIR=$MY_BASEDIR_VERSION/data
- # Next try where the source installs put it
- elif test -d $MY_BASEDIR_VERSION/var/mysql
- then
- DATADIR=$MY_BASEDIR_VERSION/var
- # Or just give up and use our compiled-in default
- else
- DATADIR=@localstatedir@
- fi
-fi
-
-if test ! -x "$bindir/mysqlcheck"
-then
- echo "Can't find program '$bindir/mysqlcheck'"
- echo "Please restart with --basedir=mysql-install-directory"
- exit 1
-fi
-
-if test ! -f "$DATADIR/mysql/user.frm"
-then
- echo "Can't find data directory. Please restart with --datadir=path-to-data-dir"
- exit 1
-fi
-
-CHECK_FILE=$DATADIR/mysql_upgrade.info
-
-if test -f $CHECK_FILE -a $force = 0
-then
- version=`cat $CHECK_FILE`
- if test "$version" = "@MYSQL_BASE_VERSION@"
- then
- if test $verbose = 1
- then
- echo "mysql_upgrade already done for this version"
- fi
- $bindir/mysql_fix_privilege_tables --silent $args
- exit 0
- fi
-fi
-
-#
-# Run the upgrade
-#
-
-check_args="--check-upgrade --all-databases --auto-repair --user=$user"
-
-if test $verbose = 1
-then
- echo "Running $bindir/mysqlcheck $args $check_args"
-fi
-
-$bindir/mysqlcheck $check_args $args
-if [ $? = 0 ]
-then
- # Remember base version so that we don't run this script again on the
- # same base version
- echo "@MYSQL_BASE_VERSION@" > $CHECK_FILE
-fi
-
-$bindir/mysql_fix_privilege_tables --silent --user=$user $args
diff --git a/scripts/mysql_zap.sh b/scripts/mysql_zap.sh
index 258e60dc356..f78212e2578 100644
--- a/scripts/mysql_zap.sh
+++ b/scripts/mysql_zap.sh
@@ -27,8 +27,8 @@ $opt_f= 0;
$opt_t= 0;
$opt_a = "";
-$BSD = -f '/vmunix' || $ENV{"OS"} eq "SunOS4" || $^O eq 'darwin';
-$LINUX = $^O eq 'linux';
+$BSD = -f '/vmunix' || $ENV{"OS"} eq "SunOS4";
+$LINUX = $^O eq 'linux' || $^O eq 'darwin';
$pscmd = $BSD ? "/bin/ps -auxww" : $LINUX ? "/bin/ps axuw" : "/bin/ps -ef";
open(TTYIN, "</dev/tty") || die "can't read /dev/tty: $!";
diff --git a/scripts/mysqld_multi.sh b/scripts/mysqld_multi.sh
index 3cb4665eb1c..f35be69c151 100644
--- a/scripts/mysqld_multi.sh
+++ b/scripts/mysqld_multi.sh
@@ -316,11 +316,11 @@ sub start_mysqlds()
$tmp.= " $options[$j]";
}
}
- if ($opt_verbose && $com =~ m/\/safe_mysqld$/ && !$info_sent)
+ if ($opt_verbose && $com =~ m/\/(safe_mysqld|mysqld_safe)$/ && !$info_sent)
{
- print "WARNING: safe_mysqld is being used to start mysqld. In this case you ";
+ print "WARNING: $1 is being used to start mysqld. In this case you ";
print "may need to pass\n\"ledir=...\" under groups [mysqldN] to ";
- print "safe_mysqld in order to find the actual mysqld binary.\n";
+ print "$1 in order to find the actual mysqld binary.\n";
print "ledir (library executable directory) should be the path to the ";
print "wanted mysqld binary.\n\n";
$info_sent= 1;
@@ -670,9 +670,9 @@ language = @datadir@/mysql/english
user = unix_user1
[mysqld3]
-mysqld = /path/to/safe_mysqld/safe_mysqld
+mysqld = /path/to/mysqld_safe
ledir = /path/to/mysqld-binary/
-mysqladmin = /path/to/mysqladmin/mysqladmin
+mysqladmin = /path/to/mysqladmin
socket = /tmp/mysql.sock3
port = 3308
pid-file = @localstatedir@3/hostname.pid3
diff --git a/scripts/mysqld_safe-watch.sh b/scripts/mysqld_safe-watch.sh
deleted file mode 100644
index f853741c87b..00000000000
--- a/scripts/mysqld_safe-watch.sh
+++ /dev/null
@@ -1,150 +0,0 @@
-#!/bin/sh
-# Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB
-# This file is public domain and comes with NO WARRANTY of any kind
-#
-# scripts to start the MySQL demon and restart it if it dies unexpectedly
-#
-# This should be executed in the MySQL base directory if you are using a
-# binary installation that has other paths than you are using.
-#
-# mysql.server works by first doing a cd to the base directory and from there
-# executing mysqld_safe
-
-# Check if we are starting this relative (for the binary release)
-if test -f ./data/mysql/db.frm -a -f ./share/mysql/english/errmsg.sys -a \
- -x ./bin/mysqld
-then
- MY_BASEDIR_VERSION=`pwd` # Where bin, share and data is
- DATADIR=$MY_BASEDIR_VERSION/data # Where the databases are
- ledir=$MY_BASEDIR_VERSION/bin # Where mysqld are
-# Check if this is a 'moved install directory'
-elif test -f ./var/mysql/db.frm -a -f ./share/mysql/english/errmsg.sys -a \
- -x ./libexec/mysqld
-then
- MY_BASEDIR_VERSION=`pwd` # Where libexec, share and var is
- DATADIR=$MY_BASEDIR_VERSION/var # Where the databases are
- ledir=$MY_BASEDIR_VERSION/libexec # Where mysqld are
-else
- MY_BASEDIR_VERSION=/usr/local/mysql
- DATADIR=/usr/local/mysql/var
- ledir=/usr/local/mysql/libexec
-fi
-
-hostname=`@HOSTNAME@`
-pidfile=$DATADIR/$hostname.pid
-log=$DATADIR/$hostname.log
-err=$DATADIR/$hostname.err
-lockfile=$DATADIR/$hostname.lock
-
-#
-# If there exists an old pid file, check if the demon is already running
-# Note: The switches to 'ps' may depend on your operating system
-
-if test -f $pidfile
-then
- PID=`cat $pidfile`
- if /bin/kill -0 $PID
- then
- if /bin/ps -p $PID | grep mysqld > /dev/null
- then # The pid contains a mysqld process
- echo "A mysqld process already exists"
- echo "A mysqld process already exists at " `date` >> $log
- exit 1;
- fi
- fi
- rm -f $pidfile
- if test -f $pidfile
- then
- echo "Fatal error: Can't remove the pid file: $pidfile"
- echo "Fatal error: Can't remove the pid file: $pidfile at " `date` >> $log
- echo "Please remove it manually and start $0 again"
- echo "mysqld demon not started"
- exit 1;
- fi
-fi
-
-echo "Starting mysqld demon with databases from $DATADIR"
-
-#Default communication ports
-#MYSQL_TCP_PORT=@MYSQL_TCP_PORT@
-if test -z "$MYSQL_UNIX_PORT"
-then
- MYSQL_UNIX_PORT="/tmp/mysql.sock"
- export MYSQL_UNIX_PORT
-fi
-#export MYSQL_TCP_PORT
-
-# Does this work on all systems?
-#if type ulimit | grep "shell builtin" > /dev/null
-#then
-# ulimit -n 256 > /dev/null 2>&1 # Fix for BSD and FreeBSD systems
-#fi
-
-echo "mysqld started on " `date` >> $log
-bin/zap -f $lockfile < /dev/null > /dev/null 2>&1
-rm -f $lockfile
-$MY_BASEDIR_VERSION/bin/watchdog_mysqld $lockfile $pidfile $MY_BASEDIR_VERSION/bin $DATADIR 3 10 >> $err 2>&1 &
-restart_pid=$!
-
-while true
-do
- rm -f $MYSQL_UNIX_PORT $pidfile # Some extra safety
- lockfile -1 -r10 $lockfile >/dev/null 2>&1
- if test "$#" -eq 0
- then
- nohup $ledir/mysqld --basedir=$MY_BASEDIR_VERSION --datadir=$DATADIR \
- --skip-external-locking >> $err 2>&1 &
- else
- nohup $ledir/mysqld --basedir=$MY_BASEDIR_VERSION --datadir=$DATADIR \
- --skip-external-locking "$@" >> $err 2>&1 &
- fi
- pid=$!
- rm -f $lockfile
- wait $pid;
-
- lockfile -1 -r10 $lockfile >/dev/null 2>&1
- rm -f $lockfile
- if test ! -f $pidfile # This is removed if normal shutdown
- then
- break;
- fi
- if true
- then
- # Test if one proces was hanging.
- # This is only a fix for Linux (running as base 3 mysqld processes)
- # but should work for the rest of the servers.
- # The only thing is ps x => redhat 5 gives warnings when using ps -x.
- # kill -9 is used or the proces won't react on the kill.
- numofproces=`ps x | grep -v "grep" | grep -c $ledir/mysqld`
- echo -e "\nNumber of processes running now: $numofproces" | tee -a $log
- I=1
- while test "$I" -le "$numofproces"
- do
- PROC=`ps x | grep $ledir/mysqld | grep -v "grep" | tail -1`
- for T in $PROC
- do
- break
- done
- # echo "TEST $I - $T **"
- if kill -9 $T
- then
- echo "mysqld proces hanging, pid $T - killed" | tee -a $log
- else
- break
- fi
- I=`expr $I + 1`
- done
- fi
- echo "mysqld restarted" | tee -a $log
- # Check all tables and repair any wrong tables.
- $MY_BASEDIR_VERSION/bin/isamchk -sf $DATADIR/*/*.ISM >> $err 2>&1
-done
-if test $restart_pid -gt 0
-then
- kill $restart_pid > /dev/null 2>&1
- sleep 1;
- kill -9 $restart_pid > /dev/null 2>&1
-fi
-
-echo -n "mysqld ended on " `date` >> $log
-echo "mysqld demon ended"
diff --git a/scripts/mysqld_safe.sh b/scripts/mysqld_safe.sh
index e6b015e7d16..23b5efcaf2b 100644
--- a/scripts/mysqld_safe.sh
+++ b/scripts/mysqld_safe.sh
@@ -2,16 +2,28 @@
# Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB
# This file is public domain and comes with NO WARRANTY of any kind
#
-# scripts to start the MySQL daemon and restart it if it dies unexpectedly
+# Script to start the MySQL daemon and restart it if it dies unexpectedly
#
# This should be executed in the MySQL base directory if you are using a
-# binary installation that has other paths than you are using.
+# binary installation that is not installed in its compile-time default
+# location
#
# mysql.server works by first doing a cd to the base directory and from there
# executing mysqld_safe
KILL_MYSQLD=1;
MYSQLD=
+niceness=0
+# Initial logging status: error log is not open, and not using syslog
+logging=init
+want_syslog=0
+syslog_tag=
+user='@MYSQLD_USER@'
+pid_file=
+err_log=
+
+syslog_tag_mysqld=mysqld
+syslog_tag_mysqld_safe=mysqld_safe
trap '' 1 2 3 15 # we shouldn't let anyone kill us
@@ -31,7 +43,6 @@ Usage: $0 [OPTIONS]
--defaults-file=FILE Use the specified defaults file
--defaults-extra-file=FILE Also use defaults from the specified file
--ledir=DIRECTORY Look for mysqld in the specified directory
- --log-error=FILE Log errors to the specified log file
--open-files-limit=LIMIT Limit the number of open files
--core-file-size=LIMIT Limit core files to the specified size
--timezone=TZ Set the system timezone
@@ -39,6 +50,9 @@ Usage: $0 [OPTIONS]
--mysqld-version=VERSION Use "mysqld-VERSION" as mysqld
--nice=NICE Set the scheduling priority of mysqld
--skip-kill-mysqld Don't try to kill stray mysqld processes
+ --syslog Log messages to syslog with 'logger'
+ --skip-syslog Log messages to error log (default)
+ --syslog-tag=TAG Pass -t "mysqld-TAG" to 'logger'
All other options are passed to the mysqld program.
@@ -46,6 +60,88 @@ EOF
exit 1
}
+my_which ()
+{
+ save_ifs="${IFS-UNSET}"
+ IFS=:
+ ret=0
+ for file
+ do
+ for dir in $PATH
+ do
+ if [ -f "$dir/$file" ]
+ then
+ echo "$dir/$file"
+ continue 2
+ fi
+ done
+
+ ret=1 #signal an error
+ break
+ done
+
+ if [ "$save_ifs" = UNSET ]
+ then
+ unset IFS
+ else
+ IFS="$save_ifs"
+ fi
+ return $ret # Success
+}
+
+log_generic () {
+ priority="$1"
+ shift
+
+ msg="`date +'%y%m%d %H:%M:%S'` mysqld_safe $*"
+ echo "$msg"
+ case $logging in
+ init) ;; # Just echo the message, don't save it anywhere
+ file) echo "$msg" >> "$err_log" ;;
+ syslog) logger -t "$syslog_tag_mysqld_safe" -p "$priority" "$*" ;;
+ *)
+ echo "Internal program error (non-fatal):" \
+ " unknown logging method '$logging'" >&2
+ ;;
+ esac
+}
+
+log_error () {
+ log_generic daemon.error "$@" >&2
+}
+
+log_notice () {
+ log_generic daemon.notice "$@"
+}
+
+eval_log_error () {
+ cmd="$1"
+ case $logging in
+ file) cmd="$cmd >> "`shell_quote_string "$err_log"`" 2>&1" ;;
+ syslog)
+ # mysqld often prefixes its messages with a timestamp, which is
+ # redundant when logging to syslog (which adds its own timestamp)
+ # However, we don't strip the timestamp with sed here, because
+ # sed buffers output (only GNU sed supports a -u (unbuffered) option)
+ # which means that messages may not get sent to syslog until the
+ # mysqld process quits.
+ cmd="$cmd 2>&1 | logger -t '$syslog_tag_mysqld' -p daemon.error"
+ ;;
+ *)
+ echo "Internal program error (non-fatal):" \
+ " unknown logging method '$logging'" >&2
+ ;;
+ esac
+
+ #echo "Running mysqld: [$cmd]"
+ eval "$cmd"
+}
+
+shell_quote_string() {
+ # This sed command makes sure that any special chars are quoted,
+ # so the arg gets passed exactly to the server.
+ echo "$1" | sed -e 's,\([^a-zA-Z0-9/_.=-]\),\\\1,g'
+}
parse_arguments() {
# We only need to pass arguments through to the server if we don't
@@ -59,47 +155,46 @@ parse_arguments() {
fi
for arg do
+ val=`echo "$arg" | sed -e "s;--[^=]*=;;"`
case "$arg" in
- --skip-kill-mysqld*)
- KILL_MYSQLD=0;
- ;;
# these get passed explicitly to mysqld
- --basedir=*) MY_BASEDIR_VERSION=`echo "$arg" | sed -e "s;--basedir=;;"` ;;
- --datadir=*) DATADIR=`echo "$arg" | sed -e "s;--datadir=;;"` ;;
- --pid-file=*) pid_file=`echo "$arg" | sed -e "s;--pid-file=;;"` ;;
- --user=*) user=`echo "$arg" | sed -e "s;--[^=]*=;;"` ; SET_USER=1 ;;
+ --basedir=*) MY_BASEDIR_VERSION="$val" ;;
+ --datadir=*) DATADIR="$val" ;;
+ --pid-file=*) pid_file="$val" ;;
+ --user=*) user="$val"; SET_USER=1 ;;
- # these two might have been set in a [mysqld_safe] section of my.cnf
+ # these might have been set in a [mysqld_safe] section of my.cnf
# they are added to mysqld command line to override settings from my.cnf
- --socket=*) mysql_unix_port=`echo "$arg" | sed -e "s;--socket=;;"` ;;
- --port=*) mysql_tcp_port=`echo "$arg" | sed -e "s;--port=;;"` ;;
+ --log-error=*) err_log="$val" ;;
+ --port=*) mysql_tcp_port="$val" ;;
+ --socket=*) mysql_unix_port="$val" ;;
# mysqld_safe-specific options - must be set in my.cnf ([mysqld_safe])!
- --ledir=*) ledir=`echo "$arg" | sed -e "s;--ledir=;;"` ;;
- --log-error=*) err_log=`echo "$arg" | sed -e "s;--log-error=;;"` ;;
- --open-files-limit=*) open_files=`echo "$arg" | sed -e "s;--open-files-limit=;;"` ;;
- --core-file-size=*) core_file_size=`echo "$arg" | sed -e "s;--core-file-size=;;"` ;;
- --timezone=*) TZ=`echo "$arg" | sed -e "s;--timezone=;;"` ; export TZ; ;;
- --mysqld=*) MYSQLD=`echo "$arg" | sed -e "s;--mysqld=;;"` ;;
+ --core-file-size=*) core_file_size="$val" ;;
+ --ledir=*) ledir="$val" ;;
+ --mysqld=*) MYSQLD="$val" ;;
--mysqld-version=*)
- tmp=`echo "$arg" | sed -e "s;--mysqld-version=;;"`
- if test -n "$tmp"
- then
- MYSQLD="mysqld-$tmp"
- else
- MYSQLD="mysqld"
- fi
- ;;
- --nice=*) niceness=`echo "$arg" | sed -e "s;--nice=;;"` ;;
- --help)
- usage
+ if test -n "$val"
+ then
+ MYSQLD="mysqld-$val"
+ else
+ MYSQLD="mysqld"
+ fi
;;
+ --nice=*) niceness="$val" ;;
+ --open-files-limit=*) open_files="$val" ;;
+ --skip-kill-mysqld*) KILL_MYSQLD=0 ;;
+ --syslog) want_syslog=1 ;;
+ --skip-syslog) want_syslog=0 ;;
+ --syslog-tag=*) syslog_tag="$val" ;;
+ --timezone=*) TZ="$val"; export TZ; ;;
+
+ --help) usage ;;
+
*)
if test -n "$pick_args"
then
- # This sed command makes sure that any special chars are quoted,
- # so the arg gets passed exactly to the server.
- args="$args "`echo "$arg" | sed -e 's,\([^a-zA-Z0-9_.-]\),\\\\\1,g'`
+ append_arg_to_args "$arg"
fi
;;
esac
@@ -109,26 +204,45 @@ parse_arguments() {
#
# First, try to find BASEDIR and ledir (where mysqld is)
-#
+#
+
+if echo '@pkgdatadir@' | grep '^@prefix@' > /dev/null
+then
+ relpkgdata=`echo '@pkgdatadir@' | sed -e 's,^@prefix@,,' -e 's,^/,,' -e 's,^,./,'`
+else
+ # pkgdatadir is not relative to prefix
+ relpkgdata='@pkgdatadir@'
+fi
MY_PWD=`pwd`
# Check for the directories we would expect from a binary release install
-if test -f ./share/mysql/english/errmsg.sys -a -x ./bin/mysqld
+if test -n "$MY_BASEDIR_VERSION" -a -d "$MY_BASEDIR_VERSION"
+then
+ # BASEDIR is already overridden on command line. Do not re-set.
+
+ # Use BASEDIR to discover le.
+ if test -x "$MY_BASEDIR_VERSION/libexec/mysqld"
+ then
+ ledir="$MY_BASEDIR_VERSION/libexec"
+ else
+ ledir="$MY_BASEDIR_VERSION/bin"
+ fi
+elif test -f "$relpkgdata"/english/errmsg.sys -a -x "$MY_PWD/bin/mysqld"
then
- MY_BASEDIR_VERSION=$MY_PWD # Where bin, share and data are
- ledir=$MY_BASEDIR_VERSION/bin # Where mysqld is
+ MY_BASEDIR_VERSION="$MY_PWD" # Where bin, share and data are
+ ledir="$MY_PWD/bin" # Where mysqld is
# Check for the directories we would expect from a source install
-elif test -f ./share/mysql/english/errmsg.sys -a \
- -x ./libexec/mysqld
+elif test -f "$relpkgdata"/english/errmsg.sys -a -x "$MY_PWD/libexec/mysqld"
then
- MY_BASEDIR_VERSION=$MY_PWD # Where libexec, share and var are
- ledir=$MY_BASEDIR_VERSION/libexec # Where mysqld is
+ MY_BASEDIR_VERSION="$MY_PWD" # Where libexec, share and var are
+ ledir="$MY_PWD/libexec" # Where mysqld is
# Since we didn't find anything, used the compiled-in defaults
else
- MY_BASEDIR_VERSION=@prefix@
- ledir=@libexecdir@
+ MY_BASEDIR_VERSION='@prefix@'
+ ledir='@libexecdir@'
fi
+
#
# Second, try to find the data directory
#
@@ -154,17 +268,17 @@ if test -z "$MYSQL_HOME"
then
if test -r "$MY_BASEDIR_VERSION/my.cnf" && test -r "$DATADIR/my.cnf"
then
- echo "WARNING: Found two instances of my.cnf -"
- echo "$MY_BASEDIR_VERSION/my.cnf and"
- echo "$DATADIR/my.cnf"
- echo "IGNORING $DATADIR/my.cnf"
- echo
+ log_error "WARNING: Found two instances of my.cnf -
+$MY_BASEDIR_VERSION/my.cnf and
+$DATADIR/my.cnf
+IGNORING $DATADIR/my.cnf"
+
MYSQL_HOME=$MY_BASEDIR_VERSION
elif test -r "$DATADIR/my.cnf"
then
- echo "WARNING: Found $DATADIR/my.cnf"
- echo "Datadir is deprecated place for my.cnf, please move it to $MY_BASEDIR_VERSION"
- echo
+ log_error "WARNING: Found $DATADIR/my.cnf
+The data directory is a deprecated location for my.cnf, please move it to
+$MY_BASEDIR_VERSION/my.cnf"
MYSQL_HOME=$DATADIR
else
MYSQL_HOME=$MY_BASEDIR_VERSION
@@ -172,16 +286,13 @@ then
fi
export MYSQL_HOME
-user=@MYSQLD_USER@
-niceness=0
-
-# these rely on $DATADIR by default, so we'll set them later on
-pid_file=
-err_log=
# Get first arguments from the my.cnf file, groups [mysqld] and [mysqld_safe]
# and then merge with the command line arguments
-if test -x ./bin/my_print_defaults
+if test -x "$MY_BASEDIR_VERSION/bin/my_print_defaults"
+then
+ print_defaults="$MY_BASEDIR_VERSION/bin/my_print_defaults"
+elif test -x ./bin/my_print_defaults
then
print_defaults="./bin/my_print_defaults"
elif test -x @bindir@/my_print_defaults
@@ -194,17 +305,103 @@ else
print_defaults="my_print_defaults"
fi
+append_arg_to_args () {
+ args="$args "`shell_quote_string "$1"`
+}
+
args=
+
SET_USER=2
parse_arguments `$print_defaults $defaults --loose-verbose mysqld server`
if test $SET_USER -eq 2
then
SET_USER=0
fi
+
parse_arguments `$print_defaults $defaults --loose-verbose mysqld_safe safe_mysqld`
parse_arguments PICK-ARGS-FROM-ARGV "$@"
-safe_mysql_unix_port=${mysql_unix_port:-${MYSQL_UNIX_PORT:-@MYSQL_UNIX_ADDR@}}
+# Determine what logging facility to use
+
+# Ensure that 'logger' exists, if it's requested
+if [ $want_syslog -eq 1 ]
+then
+ my_which logger > /dev/null 2>&1
+ if [ $? -ne 0 ]
+ then
+ log_error "--syslog requested, but no 'logger' program found. Please ensure that 'logger' is in your PATH, or do not specify the --syslog option to mysqld_safe."
+ exit 1
+ fi
+fi
+
+if [ -n "$err_log" -o $want_syslog -eq 0 ]
+then
+ if [ -n "$err_log" ]
+ then
+ # mysqld adds ".err" if there is no extension on the --log-error
+ # argument; must match that here, or mysqld_safe will write to a
+ # different log file than mysqld
+
+ # mysqld does not add ".err" to "--log-error=foo."; it considers a
+ # trailing "." as an extension
+ if expr "$err_log" : '.*\.[^/]*$' > /dev/null
+ then
+ :
+ else
+ err_log="$err_log".err
+ fi
+
+ case "$err_log" in
+ /* ) ;;
+ * ) err_log="$DATADIR/$err_log" ;;
+ esac
+ else
+ err_log=$DATADIR/`@HOSTNAME@`.err
+ fi
+
+ append_arg_to_args "--log-error=$err_log"
+
+ if [ $want_syslog -eq 1 ]
+ then
+ # User explicitly asked for syslog, so warn that it isn't used
+ log_error "Can't log to error log and syslog at the same time. Remove all --log-error configuration options for --syslog to take effect."
+ fi
+
+ # Log to err_log file
+ log_notice "Logging to '$err_log'."
+ logging=file
+else
+ if [ -n "$syslog_tag" ]
+ then
+ # Sanitize the syslog tag
+ syslog_tag=`echo "$syslog_tag" | sed -e 's/[^a-zA-Z0-9_-]/_/g'`
+ syslog_tag_mysqld_safe="${syslog_tag_mysqld_safe}-$syslog_tag"
+ syslog_tag_mysqld="${syslog_tag_mysqld}-$syslog_tag"
+ fi
+ log_notice "Logging to syslog."
+ logging=syslog
+fi
+
+USER_OPTION=""
+if test -w / -o "$USER" = "root"
+then
+ if test "$user" != "root" -o $SET_USER = 1
+ then
+ USER_OPTION="--user=$user"
+ fi
+ # Change the err log to the right user, if it is in use
+ if [ $want_syslog -eq 0 ]; then
+ touch "$err_log"
+ chown $user "$err_log"
+ fi
+ if test -n "$open_files"
+ then
+ ulimit -n $open_files
+ append_arg_to_args "--open-files-limit=$open_files"
+ fi
+fi
+
+safe_mysql_unix_port=${mysql_unix_port:-${MYSQL_UNIX_PORT:-@MYSQL_UNIX_ADDR@}}
# Make sure that directory for $safe_mysql_unix_port exists
mysql_unix_port_dir=`dirname $safe_mysql_unix_port`
if [ ! -d $mysql_unix_port_dir ]
@@ -214,46 +411,40 @@ then
chmod 755 $mysql_unix_port_dir
fi
-# Use the mysqld-max binary by default if the user doesn't specify a binary
+# If the user doesn't specify a binary, we assume name "mysqld"
if test -z "$MYSQLD"
then
- if test -x $ledir/mysqld-max
- then
- MYSQLD=mysqld-max
- else
- MYSQLD=mysqld
- fi
+ MYSQLD=mysqld
fi
-if test ! -x $ledir/$MYSQLD
+if test ! -x "$ledir/$MYSQLD"
then
- echo "The file $ledir/$MYSQLD doesn't exist or is not executable"
- echo "Please do a cd to the mysql installation directory and restart"
- echo "this script from there as follows:"
- echo "./bin/mysqld_safe".
- echo "See http://dev.mysql.com/doc/mysql/en/mysqld-safe.html for more"
- echo "information"
+ log_error "The file $ledir/$MYSQLD
+does not exist or is not executable. Please cd to the mysql installation
+directory and restart this script from there as follows:
+./bin/mysqld_safe&
+See http://dev.mysql.com/doc/mysql/en/mysqld-safe.html for more information"
exit 1
fi
if test -z "$pid_file"
then
- pid_file=$DATADIR/`@HOSTNAME@`.pid
+ pid_file="$DATADIR/`@HOSTNAME@`.pid"
else
case "$pid_file" in
/* ) ;;
* ) pid_file="$DATADIR/$pid_file" ;;
esac
fi
-test -z "$err_log" && err_log=$DATADIR/`@HOSTNAME@`.err
+append_arg_to_args "--pid-file=$pid_file"
if test -n "$mysql_unix_port"
then
- args="--socket=$mysql_unix_port $args"
+ append_arg_to_args "--socket=$mysql_unix_port"
fi
if test -n "$mysql_tcp_port"
then
- args="--port=$mysql_tcp_port $args"
+ append_arg_to_args "--port=$mysql_tcp_port"
fi
if test $niceness -eq 0
@@ -271,7 +462,7 @@ fi
if nohup nice > /dev/null 2>&1
then
normal_niceness=`nice`
- nohup_niceness=`nohup nice`
+ nohup_niceness=`nohup nice 2>/dev/null`
numeric_nice_values=1
for val in $normal_niceness $nohup_niceness
@@ -308,22 +499,6 @@ else
fi
fi
-USER_OPTION=""
-if test -w / -o "$USER" = "root"
-then
- if test "$user" != "root" -o $SET_USER = 1
- then
- USER_OPTION="--user=$user"
- fi
- # If we are root, change the err log to the right user.
- touch $err_log; chown $user $err_log
- if test -n "$open_files"
- then
- ulimit -n $open_files
- args="--open-files-limit=$open_files $args"
- fi
-fi
-
# Try to set the core file size (even if we aren't root) because many systems
# don't specify a hard limit on core file size.
if test -n "$core_file_size"
@@ -334,25 +509,24 @@ fi
#
# If there exists an old pid file, check if the daemon is already running
# Note: The switches to 'ps' may depend on your operating system
-if test -f $pid_file
+if test -f "$pid_file"
then
- PID=`cat $pid_file`
+ PID=`cat "$pid_file"`
if @CHECK_PID@
then
if @FIND_PROC@
then # The pid contains a mysqld process
- echo "A mysqld process already exists"
- echo "A mysqld process already exists at " `date` >> $err_log
+ log_error "A mysqld process already exists"
exit 1
fi
fi
- rm -f $pid_file
- if test -f $pid_file
+ rm -f "$pid_file"
+ if test -f "$pid_file"
then
- echo "Fatal error: Can't remove the pid file: $pid_file"
- echo "Fatal error: Can't remove the pid file: $pid_file at " `date` >> $err_log
- echo "Please remove it manually and start $0 again"
- echo "mysqld daemon not started"
+ log_error "Fatal error: Can't remove the pid file:
+$pid_file
+Please remove it manually and start $0 again;
+mysqld daemon not started"
exit 1
fi
fi
@@ -369,27 +543,32 @@ fi
# $MY_BASEDIR_VERSION/bin/myisamchk --silent --force --fast --medium-check $DATADIR/*/*.MYI
# $MY_BASEDIR_VERSION/bin/isamchk --silent --force $DATADIR/*/*.ISM
-echo "Starting $MYSQLD daemon with databases from $DATADIR"
-
# Does this work on all systems?
#if type ulimit | grep "shell builtin" > /dev/null
#then
# ulimit -n 256 > /dev/null 2>&1 # Fix for BSD and FreeBSD systems
#fi
-echo "`date +'%y%m%d %H:%M:%S mysqld started'`" >> $err_log
+cmd="$NOHUP_NICENESS"
+
+for i in "$ledir/$MYSQLD" "$defaults" "--basedir=$MY_BASEDIR_VERSION" \
+ "--datadir=$DATADIR" "$USER_OPTION"
+do
+ cmd="$cmd "`shell_quote_string "$i"`
+done
+cmd="$cmd $args"
+# Avoid 'nohup: ignoring input' warning
+test -n "$NOHUP_NICENESS" && cmd="$cmd < /dev/null"
+
+log_notice "Starting $MYSQLD daemon with databases from $DATADIR"
while true
do
- rm -f $safe_mysql_unix_port $pid_file # Some extra safety
- if test -z "$args"
- then
- $NOHUP_NICENESS $ledir/$MYSQLD $defaults --basedir=$MY_BASEDIR_VERSION --datadir=$DATADIR $USER_OPTION --pid-file=$pid_file @MYSQLD_DEFAULT_SWITCHES@ >> $err_log 2>&1
- else
- eval "$NOHUP_NICENESS $ledir/$MYSQLD $defaults --basedir=$MY_BASEDIR_VERSION --datadir=$DATADIR $USER_OPTION --pid-file=$pid_file @MYSQLD_DEFAULT_SWITCHES@ $args >> $err_log 2>&1"
- fi
- if test ! -f $pid_file # This is removed if normal shutdown
+ rm -f $safe_mysql_unix_port "$pid_file" # Some extra safety
+
+ eval_log_error "$cmd"
+
+ if test ! -f "$pid_file" # This is removed if normal shutdown
then
- echo "STOPPING server from pid file $pid_file"
break
fi
@@ -402,7 +581,7 @@ do
# kill -9 is used or the process won't react on the kill.
numofproces=`ps xaww | grep -v "grep" | grep "$ledir/$MYSQLD\>" | grep -c "pid-file=$pid_file"`
- echo -e "\nNumber of processes running now: $numofproces" | tee -a $err_log
+ log_notice "Number of processes running now: $numofproces"
I=1
while test "$I" -le "$numofproces"
do
@@ -415,16 +594,15 @@ do
# echo "TEST $I - $T **"
if kill -9 $T
then
- echo "$MYSQLD process hanging, pid $T - killed" | tee -a $err_log
- else
+ log_error "$MYSQLD process hanging, pid $T - killed"
+ else
break
fi
I=`expr $I + 1`
done
fi
- echo "`date +'%y%m%d %H:%M:%S'` mysqld restarted" | tee -a $err_log
+ log_notice "mysqld restarted"
done
-echo "`date +'%y%m%d %H:%M:%S'` mysqld ended" | tee -a $err_log
-echo "" | tee -a $err_log
+log_notice "mysqld from pid file $pid_file ended"
diff --git a/scripts/mysqldumpslow.sh b/scripts/mysqldumpslow.sh
index 009745fd896..8580b8e6203 100644
--- a/scripts/mysqldumpslow.sh
+++ b/scripts/mysqldumpslow.sh
@@ -20,7 +20,7 @@ GetOptions(\%opt,
'v|verbose+',# verbose
'help+', # write usage info
'd|debug+', # debug
- 's=s', # what to sort by (t, at, l, al, r, ar etc)
+ 's=s', # what to sort by (al, at, ar, c, t, l, r)
'r!', # reverse the sort order (largest last instead of first)
't=i', # just show the top n queries
'a!', # don't abstract all numbers to N and strings to 'S'
@@ -83,7 +83,7 @@ while ( defined($_ = shift @pending) or defined($_ = <>) ) {
s/^#? Time: \d{6}\s+\d+:\d+:\d+.*\n//;
my ($user,$host) = s/^#? User\@Host:\s+(\S+)\s+\@\s+(\S+).*\n// ? ($1,$2) : ('','');
- s/^# Query_time: (\d+) Lock_time: (\d+) Rows_sent: (\d+).*\n//;
+ s/^# Query_time: ([0-9.]+)\s+Lock_time: ([0-9.]+)\s+Rows_sent: ([0-9.]+).*\n//;
my ($t, $l, $r) = ($1, $2, $3);
$t -= $l unless $opt{l};
@@ -163,7 +163,14 @@ Parse and summarize the MySQL slow query log. Options are
-v verbose
-d debug
- -s ORDER what to sort by (t, at, l, al, r, ar etc), 'at' is default
+ -s ORDER what to sort by (al, at, ar, c, l, r, t), 'at' is default
+ al: average lock time
+ ar: average rows sent
+ at: average query time
+ c: count
+ l: lock time
+ r: rows sent
+ t: query time
-r reverse the sort order (largest last instead of first)
-t NUM just show the top n queries
-a don't abstract all numbers to N and strings to 'S'