summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorunknown <monty@mysql.com>2004-10-29 19:26:52 +0300
committerunknown <monty@mysql.com>2004-10-29 19:26:52 +0300
commitf095274fe8c3d3394d6c0ce0a68f4bea04311999 (patch)
tree23bcc9a71fe7237887a111b158e30f5a6bb665d3 /scripts
parentf41bba8c6156a7adf4c67dfa75e16112767a5d3c (diff)
parent5be6c328f5a9f78f37176bbbd88a538fa3b65fe9 (diff)
downloadmariadb-git-f095274fe8c3d3394d6c0ce0a68f4bea04311999.tar.gz
merge with 4.1
BitKeeper/etc/ignore: auto-union BitKeeper/etc/logging_ok: auto-union BitKeeper/triggers/post-commit: Auto merged Docs/Support/texi2html: Auto merged Makefile.am: Auto merged client/Makefile.am: Auto merged client/mysql.cc: Auto merged client/mysqldump.c: Auto merged include/my_base.h: Auto merged include/my_global.h: Auto merged include/my_pthread.h: Auto merged include/my_sys.h: Auto merged include/my_time.h: Auto merged include/mysql.h: Auto merged include/mysql_com.h: Auto merged innobase/buf/buf0buf.c: Auto merged innobase/include/row0mysql.h: Auto merged innobase/row/row0sel.c: Auto merged libmysql/libmysql.c: Auto merged libmysqld/examples/Makefile.am: Auto merged myisam/mi_check.c: Auto merged mysql-test/include/ps_modify.inc: Auto merged mysql-test/install_test_db.sh: Auto merged mysql-test/r/alter_table.result: Auto merged mysql-test/r/auto_increment.result: Auto merged mysql-test/r/bdb.result: Auto merged mysql-test/r/ctype_latin1_de.result: Auto merged mysql-test/r/ctype_recoding.result: Auto merged mysql-test/r/fulltext.result: Auto merged mysql-test/r/func_gconcat.result: Auto merged mysql-test/r/func_group.result: Auto merged mysql-test/r/func_if.result: Auto merged mysql-test/t/derived.test: Auto merged mysql-test/t/insert.test: merge with 4.1 Fixed test case to not use 'if exists' when it shouldn't mysql-test/t/range.test: merge with 4.1 Added missing drop table sql/ha_ndbcluster.cc: merge with 4.1 Simple optimization: use max() instead of ? : sql/item_func.cc: merge with 4.1 (Added back old variable names for easier merges) sql/opt_range.cc: merge with 4.1 Removed argument 'parent_alloc' from QUICK_RANGE_SELECT as this was not used Added assert if using QUICK_GROUP_MIN_MAX_SELECT with parent_alloc as the init() function can't handle this Changed back get_quick_select_for_ref() to use it's own alloc root becasue this function may be called several times for one query sql/sql_handler.cc: merge with 4.1 change variable 'err' to 'error' as same function had a label named 'err' sql/sql_update.cc: Use multi-update code from 5.0 instead of 4.1 We will fix the locking code shortly in 5.0 to be faster than in 4.1
Diffstat (limited to 'scripts')
-rw-r--r--scripts/Makefile.am1
-rw-r--r--scripts/make_binary_distribution.sh6
-rw-r--r--scripts/make_win_src_distribution.sh37
-rw-r--r--scripts/mysql_config.sh2
-rw-r--r--scripts/mysql_install_db.sh2
-rw-r--r--scripts/mysqld_multi.sh420
-rw-r--r--scripts/mysqld_safe.sh37
-rw-r--r--scripts/mysqlhotcopy.sh10
8 files changed, 284 insertions, 231 deletions
diff --git a/scripts/Makefile.am b/scripts/Makefile.am
index d4da77d0387..4158b5a34dc 100644
--- a/scripts/Makefile.am
+++ b/scripts/Makefile.am
@@ -139,6 +139,7 @@ SUFFIXES = .sh
-e 's!@''IS_LINUX''@!@IS_LINUX@!' \
-e "s!@""CONF_COMMAND""@!@CONF_COMMAND@!" \
-e 's!@''MYSQLD_USER''@!@MYSQLD_USER@!' \
+ -e "s!@MAKE@!$(MAKE)!" \
$< > $@-t
@CHMOD@ +x $@-t
@MV@ $@-t $@
diff --git a/scripts/make_binary_distribution.sh b/scripts/make_binary_distribution.sh
index 87473d6bd17..d79245a1aad 100644
--- a/scripts/make_binary_distribution.sh
+++ b/scripts/make_binary_distribution.sh
@@ -187,7 +187,7 @@ fi
if [ $BASE_SYSTEM != "netware" ] ; then
if [ -d tests ] ; then
- $CP tests/*.res tests/*.tst tests/*.pl $BASE/tests
+ $CP tests/client_test tests/*.res tests/*.tst tests/*.pl $BASE/tests
fi
if [ -d man ] ; then
$CP man/*.1 $BASE/man/man1
@@ -269,8 +269,8 @@ fi
# NDB Cluster
if [ x$NDBCLUSTER = x1 ]; then
- ( cd ndb ; make DESTDIR=$BASE/ndb-stage install )
- ( cd mysql-test/ndb ; make DESTDIR=$BASE/ndb-stage install )
+ ( cd ndb ; @MAKE@ DESTDIR=$BASE/ndb-stage install )
+ ( cd mysql-test/ndb ; @MAKE@ DESTDIR=$BASE/ndb-stage install )
$CP $BASE/ndb-stage@bindir@/* $BASE/bin/.
$CP $BASE/ndb-stage@libexecdir@/* $BASE/bin/.
$CP $BASE/ndb-stage@pkglibdir@/* $BASE/lib/.
diff --git a/scripts/make_win_src_distribution.sh b/scripts/make_win_src_distribution.sh
index 19a5fb7276b..fd7884068ba 100644
--- a/scripts/make_win_src_distribution.sh
+++ b/scripts/make_win_src_distribution.sh
@@ -6,7 +6,6 @@
version=@VERSION@
export version
-SOURCE=`pwd`
CP="cp -p"
DEBUG=0
@@ -24,6 +23,7 @@ if [ ! -f scripts/make_win_src_distribution ]; then
echo "ERROR : You must run this script from the MySQL top-level directory"
exit 1
fi
+SOURCE=`pwd`
#
# Check for source compilation/configuration
@@ -119,7 +119,7 @@ unix_to_dos()
for arg do
print_debug "Replacing LF -> CRLF from '$arg'"
- cat $arg | awk '{sub(/$/,"\r");print}' > $arg.tmp
+ awk '{sub(/$/,"\r");print}' < $arg > $arg.tmp
rm -f $arg
mv $arg.tmp $arg
done
@@ -138,14 +138,6 @@ if [ -d $BASE ] ; then
fi
$CP -r $SOURCE/VC++Files $BASE
-(
-find $BASE \( -name "*.dsp" -o -name "*.dsw" \) -and -not -path \*SCCS\* -print
-)|(
- while read v
- do
- unix_to_dos $v
- done
-)
#
# Process version tags in InstallShield files
@@ -281,7 +273,6 @@ for i in COPYING ChangeLog README EXCEPTIONS-CLIENT\
Docs/manual_toc.html Docs/manual.html \
Docs/manual.txt Docs/mysqld_error.txt \
Docs/INSTALL-BINARY Docs/internals.texi
-
do
print_debug "Copying file '$i'"
if [ -f $i ]
@@ -294,14 +285,19 @@ done
# support files
#
mkdir $BASE/support-files
-cp support-files/*.cnf $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 Docs/Flags scripts sql-bench SSL \
- tests
+for i in scripts sql-bench SSL tests
do
print_debug "Copying directory '$i'"
if [ -d $i ]
@@ -317,7 +313,18 @@ done
./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
-unix_to_dos $BASE/README
+#
+# Search the tree for plain text files and adapt the line end marker
+#
+find $BASE \( -name "*.dsp" -o -name "*.dsw" -o -name "*.cnf" -o -name "*.ini" \
+ -o -name COPYING -o -name ChangeLog -o -name EXCEPTIONS-CLIENT -o -name "INSTALL*" -o -name LICENSE -o -name "README*" \) -type f -print \
+| while read v
+ do
+ unix_to_dos $v
+ done
+# File extension '.txt' matches too many other files, error messages etc.
+unix_to_dos $BASE/Docs/*.txt
+
mv $BASE/README $BASE/README.txt
#
diff --git a/scripts/mysql_config.sh b/scripts/mysql_config.sh
index aa7af1cb2c6..86cbe944416 100644
--- a/scripts/mysql_config.sh
+++ b/scripts/mysql_config.sh
@@ -92,7 +92,7 @@ libs_r="$ldflags -L$pkglibdir -lmysqlclient_r @LIBS@ @openssl_libs@"
libs_r=`echo "$libs_r" | sed -e 's; \+; ;g' | sed -e 's;^ *;;' | sed -e 's; *\$;;'`
cflags="-I$pkgincludedir @CFLAGS@ " #note: end space!
include="-I$pkgincludedir"
-embedded_libs="$ldflags -L$pkglibdir -lmysqld @LIBS@ @WRAPLIBS@ @innodb_system_libs@"
+embedded_libs="$ldflags -L$pkglibdir -lmysqld @LIBS@ @WRAPLIBS@ @innodb_system_libs@ $client_libs"
embedded_libs=`echo "$embedded_libs" | sed -e 's; \+; ;g' | sed -e 's;^ *;;' | sed -e 's; *\$;;'`
# Remove some options that a client doesn't have to care about
diff --git a/scripts/mysql_install_db.sh b/scripts/mysql_install_db.sh
index aa5b99aebcc..b4f59790e73 100644
--- a/scripts/mysql_install_db.sh
+++ b/scripts/mysql_install_db.sh
@@ -213,7 +213,7 @@ then
fi
mysqld_install_cmd_line="$mysqld $defaults $mysqld_opt --bootstrap \
--skip-grant-tables --basedir=$basedir --datadir=$ldata --skip-innodb \
---skip-bdb $args --max_allowed_packet=8M"
+--skip-bdb --skip-ndbcluster $args --max_allowed_packet=8M"
if $scriptdir/mysql_create_system_tables $create_option $mdata $hostname $windows \
| eval "$mysqld_install_cmd_line"
then
diff --git a/scripts/mysqld_multi.sh b/scripts/mysqld_multi.sh
index 9767976460c..ba46fd6fa29 100644
--- a/scripts/mysqld_multi.sh
+++ b/scripts/mysqld_multi.sh
@@ -4,7 +4,7 @@ use Getopt::Long;
use POSIX qw(strftime);
$|=1;
-$VER="2.7";
+$VER="2.11";
$opt_config_file = undef();
$opt_example = 0;
@@ -17,6 +17,8 @@ $opt_password = undef();
$opt_tcp_ip = 0;
$opt_user = "root";
$opt_version = 0;
+$opt_silent = 0;
+$opt_verbose = 0;
my $my_print_defaults_exists= 1;
my $logdir= undef();
@@ -75,10 +77,17 @@ sub main
splice @ARGV, 0, 0, @defops;
}
GetOptions("help","example","version","mysqld=s","mysqladmin=s",
- "config-file=s","user=s","password=s","log=s","no-log","tcp-ip")
+ "config-file=s","user=s","password=s","log=s","no-log","tcp-ip",
+ "silent","verbose")
|| die "Wrong option! See $my_progname --help for detailed information!\n";
- init_log();
+ if ($opt_verbose && $opt_silent)
+ {
+ print "Both --verbose and --silent has been given. Some of the warnings ";
+ print "will be disabled\nand some will be enabled.\n\n";
+ }
+
+ init_log() if (!defined($opt_log));
$groupids = $ARGV[1];
if ($opt_version)
{
@@ -86,16 +95,6 @@ sub main
exit(0);
}
example() if ($opt_example);
- if (!defined(($mysqld = my_which($opt_mysqld))))
- {
- print "Couldn't find the mysqld binary! Tried: $opt_mysqld\n";
- $flag_exit=1;
- }
- if (!defined(($mysqladmin = my_which($opt_mysqladmin))))
- {
- print "Couldn't find the mysqladmin binary! Tried: $opt_mysqladmin\n";
- $flag_exit=1;
- }
usage() if ($opt_help);
if ($flag_exit)
{
@@ -111,9 +110,9 @@ sub main
exit(1);
}
usage() if (!defined($ARGV[0]) ||
- ($ARGV[0] ne 'start' && $ARGV[0] ne 'START' &&
- $ARGV[0] ne 'stop' && $ARGV[0] ne 'STOP' &&
- $ARGV[0] ne 'report' && $ARGV[0] ne 'REPORT'));
+ (!($ARGV[0] =~ m/^start$/i) &&
+ !($ARGV[0] =~ m/^stop$/i) &&
+ !($ARGV[0] =~ m/^report$/i)));
if (!$opt_no_log)
{
@@ -126,56 +125,34 @@ sub main
print strftime "%a %b %e %H:%M:%S %Y", localtime;
print "\n";
}
- if ($ARGV[0] eq 'report' || $ARGV[0] eq 'REPORT')
- {
- report_mysqlds();
- }
- elsif ($ARGV[0] eq 'start' || $ARGV[0] eq 'START')
+ if ($ARGV[0] =~ m/^start$/i)
{
+ if (!defined(($mysqld= my_which($opt_mysqld))) && $opt_verbose)
+ {
+ print "WARNING: Couldn't find the default mysqld binary.\n";
+ print "Tried: $opt_mysqld\n";
+ print "This is OK, if you are using option \"mysqld=...\" in ";
+ print "groups [mysqldN] separately for each.\n\n";
+ }
start_mysqlds();
}
else
{
- stop_mysqlds();
- }
-}
-
-####
-#### Init log file. Check for appropriate place for log file, in the following
-#### order my_print_defaults mysqld datadir, @datadir@, /var/log, /tmp
-####
-
-sub init_log
-{
- if ($my_print_defaults_exists)
- {
- @mysqld_opts= `my_print_defaults mysqld`;
- chomp @mysqld_opts;
- foreach my $opt (@mysqld_opts)
+ if (!defined(($mysqladmin= my_which($opt_mysqladmin))) && $opt_verbose)
{
- if ($opt =~ m/^\-\-datadir[=](.*)/)
- {
- if (-d "$1" && -w "$1")
- {
- $logdir= $1;
- }
- }
+ print "WARNING: Couldn't find the default mysqladmin binary.\n";
+ print "Tried: $opt_mysqladmin\n";
+ print "This is OK, if you are using option \"mysqladmin=...\" in ";
+ print "groups [mysqldN] separately for each.\n\n";
+ }
+ if ($ARGV[0] =~ m/^report$/i)
+ {
+ report_mysqlds();
+ }
+ else
+ {
+ stop_mysqlds();
}
- }
- if (!defined($logdir))
- {
- $logdir= "@datadir@" if (-d "@datadir@" && -w "@datadir@");
- }
- if (!defined($logdir))
- {
- # Log file was not specified and we could not log to a standard place,
- # so log file be disabled for now.
- print "WARNING: Log file disabled. Maybe directory/file isn't writable?\n";
- $opt_no_log= 1;
- }
- else
- {
- $opt_log= "$logdir/mysqld_multi.log";
}
}
@@ -209,7 +186,10 @@ sub init_log
{
# Log file was not specified and we could not log to a standard place,
# so log file be disabled for now.
- print "WARNING: Log file disabled. Maybe directory/file isn't writable?\n";
+ if (!$opt_silent)
+ {
+ print "WARNING: Log file disabled. Maybe directory or file isn't writable?\n";
+ }
$opt_no_log= 1;
}
else
@@ -224,7 +204,7 @@ sub init_log
sub report_mysqlds
{
- my (@groups, $com, $i, @options, $j, $pec);
+ my (@groups, $com, $i, @options, $pec);
print "Reporting MySQL servers\n";
if (!$opt_no_log)
@@ -234,23 +214,7 @@ sub report_mysqlds
@groups = &find_groups($groupids);
for ($i = 0; defined($groups[$i]); $i++)
{
- $com = "my_print_defaults";
- $com.= defined($opt_config_file) ? " --config-file=$opt_config_file" : "";
- $com.= " $groups[$i]";
- @options = `$com`;
- chop @options;
-
- $com = "$mysqladmin -u $opt_user";
- $com.= defined($opt_password) ? " -p$opt_password" : "";
- $com.= $opt_tcp_ip ? " -h 127.0.0.1" : "";
- for ($j = 0; defined($options[$j]); $j++)
- {
- if ((($options[$j] =~ m/^(\-\-socket\=)(.*)$/) && !$opt_tcp_ip) ||
- ($options[$j] =~ m/^(\-\-port\=)(.*)$/))
- {
- $com.= " $options[$j]";
- }
- }
+ $com= get_mysqladmin_options($i, @groups);
$com.= " ping >> /dev/null 2>&1";
system($com);
$pec = $? >> 8;
@@ -289,7 +253,7 @@ sub report_mysqlds
sub start_mysqlds()
{
- my (@groups, $com, $tmp, $i, @options, $j);
+ my (@groups, $com, $tmp, $i, @options, $j, $mysqld_found, $info_sent);
if (!$opt_no_log)
{
@@ -308,13 +272,20 @@ sub start_mysqlds()
@options = `$com`;
chop @options;
+ $mysqld_found= 1; # The default
+ $mysqld_found= 0 if (!length($mysqld));
$com= "$mysqld";
for ($j = 0, $tmp= ""; defined($options[$j]); $j++)
{
- if ("--mysqld=" eq substr($options[$j], 0, 9))
+ if ("--mysqladmin=" eq substr($options[$j], 0, 13))
+ {
+ # catch this and ignore
+ }
+ elsif ("--mysqld=" eq substr($options[$j], 0, 9))
{
$options[$j]=~ s/\-\-mysqld\=//;
$com= $options[$j];
+ $mysqld_found= 1;
}
else
{
@@ -322,9 +293,27 @@ sub start_mysqlds()
$tmp.= " $options[$j]";
}
}
+ if ($opt_verbose && $com =~ m/\/safe_mysqld$/ && !$info_sent)
+ {
+ print "WARNING: safe_mysqld 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 "ledir (library executable directory) should be the path to the ";
+ print "wanted mysqld binary.\n\n";
+ $info_sent= 1;
+ }
$com.= $tmp;
$com.= " >> $opt_log 2>&1" if (!$opt_no_log);
$com.= " &";
+ if (!$mysqld_found)
+ {
+ print "\n";
+ print "FATAL ERROR: Tried to start mysqld under group [$groups[$i]], ";
+ print "but no mysqld binary was found.\n";
+ print "Please add \"mysqld=...\" in group [mysqld_multi], or add it to ";
+ print "group [$groups[$i]] separately.\n";
+ exit(1);
+ }
system($com);
}
if (!$i && !$opt_no_log)
@@ -340,7 +329,7 @@ sub start_mysqlds()
sub stop_mysqlds()
{
- my (@groups, $com, $i, @options, $j);
+ my (@groups, $com, $i, @options);
if (!$opt_no_log)
{
@@ -353,23 +342,7 @@ sub stop_mysqlds()
@groups = &find_groups($groupids);
for ($i = 0; defined($groups[$i]); $i++)
{
- $com = "my_print_defaults";
- $com.= defined($opt_config_file) ? " --config-file=$opt_config_file" : "";
- $com.= " $groups[$i]";
- @options = `$com`;
- chop @options;
-
- $com = "$mysqladmin -u $opt_user";
- $com.= defined($opt_password) ? " -p$opt_password" : "";
- $com.= $opt_tcp_ip ? " -h 127.0.0.1" : "";
- for ($j = 0; defined($options[$j]); $j++)
- {
- if ((($options[$j] =~ m/^(\-\-socket\=)(.*)$/) && !$opt_tcp_ip) ||
- ($options[$j] =~ m/^(\-\-port\=)(.*)$/))
- {
- $com.= " $options[$j]";
- }
- }
+ $com= get_mysqladmin_options($i, @groups);
$com.= " shutdown";
$com.= " >> $opt_log 2>&1" if (!$opt_no_log);
$com.= " &";
@@ -383,6 +356,54 @@ sub stop_mysqlds()
}
####
+#### Sub function for mysqladmin option parsing
+####
+
+sub get_mysqladmin_options
+{
+ my ($i, @groups)= @_;
+ my ($mysqladmin_found, $com, $tmp, $j);
+
+ $com = "my_print_defaults";
+ $com.= defined($opt_config_file) ? " --config-file=$opt_config_file" : "";
+ $com.= " $groups[$i]";
+ @options = `$com`;
+ chop @options;
+
+ $mysqladmin_found= 1; # The default
+ $mysqladmin_found= 0 if (!length($mysqladmin));
+ $com = "$mysqladmin";
+ $tmp = " -u $opt_user";
+ $tmp.= defined($opt_password) ? " -p$opt_password" : "";
+ $tmp.= $opt_tcp_ip ? " -h 127.0.0.1" : "";
+ for ($j = 0; defined($options[$j]); $j++)
+ {
+ if ("--mysqladmin=" eq substr($options[$j], 0, 13))
+ {
+ $options[$j]=~ s/\-\-mysqladmin\=//;
+ $com= $options[$j];
+ $mysqladmin_found= 1;
+ }
+ elsif ((($options[$j] =~ m/^(\-\-socket\=)(.*)$/) && !$opt_tcp_ip) ||
+ ($options[$j] =~ m/^(\-\-port\=)(.*)$/))
+ {
+ $tmp.= " $options[$j]";
+ }
+ }
+ if (!$mysqladmin_found)
+ {
+ print "\n";
+ print "FATAL ERROR: Tried to use mysqladmin in group [$groups[$i]], ";
+ print "but no mysqladmin binary was found.\n";
+ print "Please add \"mysqladmin=...\" in group [mysqld_multi], or ";
+ print "in group [$groups[$i]].\n";
+ exit(1);
+ }
+ $com.= $tmp;
+ return $com;
+}
+
+####
#### Find groups. Takes the valid group numbers as an argument, parses
#### them, puts them in the ascending order, removes duplicates and
#### returns the wanted groups accordingly.
@@ -556,67 +577,92 @@ sub my_which
sub example
{
print <<EOF;
-# This is an example of a my.cnf file on behalf of $my_progname.
-# This file should probably be in your home dir (~/.my.cnf) or /etc/my.cnf
-# Version $VER by Jani Tolonen
-# NOTES:
-# 1.Make sure that the MySQL user, who is stopping the mysqld services (e.g
-# using the mysqladmin) have the same password and username for all the
-# data directories accessed (to the 'mysql' database) And make sure that
-# the user has the 'Shutdown_priv' privilege! If you have many data-
-# directories and many different 'mysql' databases with different passwords
-# for the MySQL 'root' user, you may want to create a common 'multi_admin'
-# user for each using the same password (see below). Example how to do it:
-# shell> mysql -u root -S /tmp/mysql.sock -proot_password -e
-# "GRANT SHUTDOWN ON *.* TO multi_admin\@localhost IDENTIFIED BY 'multipass'"
-# You will have to do the above for each mysqld running in each data
-# directory, that you have (just change the socket, -S=...)
-# See more detailed information from chapter:
-# '6 The MySQL Access Privilege System' from the MySQL manual.
-# 2.pid-file is very important, if you are using mysqld_safe to start mysqld
-# (e.g. --mysqld=mysqld_safe) Every mysqld should have it's own pid-file.
-# The advantage using mysqld_safe instead of mysqld directly here is, that
-# mysqld_safe 'guards' every mysqld process and will restart it, if mysqld
-# process fails due to signal kill -9, or similar. (Like segmentation fault,
-# which MySQL should never do, of course ;) Please note that mysqld_safe
-# script may require that you start it from a certain place. This means that
-# you may have to CD to a certain directory, before you start the
-# mysqld_multi. If you have problems starting, please see the script.
-# Check especially the lines:
-# --------------------------------------------------------------------------
-# MY_PWD=`pwd`
-# Check if we are starting this relative (for the binary release)
-# if test -d $MY_PWD/data/mysql -a -f ./share/mysql/english/errmsg.sys -a \
-# -x ./bin/mysqld
-# --------------------------------------------------------------------------
-# The above test should be successful, or you may encounter problems.
-# 3.Beware of the dangers starting multiple mysqlds in the same data directory.
-# Use separate data directories, unless you *KNOW* what you are doing!
-# 4.The socket file and the TCP/IP port must be different for every mysqld.
-# 5.The first and fifth mysqld was intentionally left out from the example.
-# You may have 'gaps' in the config file. This gives you more flexibility.
-# The order in which the mysqlds are started or stopped depends on the order
-# in which they appear in the config file.
-# 6.When you want to refer to a certain group with GNR with this program,
-# just use the number in the end of the group name ( [mysqld# <== )
-# 7.You may want to use option '--user' for mysqld, but in order to do this
-# you need to be root when you start this script. Having the option
-# in the config file doesn't matter; you will just get a warning, if you are
-# not the superuser and the mysqlds are started under *your* unix account.
-# IMPORTANT: Make sure that the pid-file and the data directory are
-# read+write(+execute for the latter one) accessible for *THAT* UNIX user,
-# who the specific mysqld process is started as. *DON'T* use the UNIX root
-# account for this, unless you *KNOW* what you are doing!
-# 8.MOST IMPORTANT: Make sure that you understand the meanings of the options
-# that are passed to the mysqlds and why *WOULD YOU WANT* to have separate
-# mysqld processes. Starting multiple mysqlds in one data directory *WON'T*
-# give you extra performance in a threaded system!
+# This is an example of a my.cnf file for $my_progname.
+# Usually this file is located in home dir ~/.my.cnf or /etc/my.cnf
+#
+# SOME IMPORTANT NOTES FOLLOW:
+#
+# 1.COMMON USER
+#
+# Make sure that the MySQL user, who is stopping the mysqld services, has
+# the same password to all MySQL servers being accessed by $my_progname.
+# This user needs to have the 'Shutdown_priv' -privilege, but for security
+# reasons should have no other privileges. It is advised that you create a
+# common 'multi_admin' user for all MySQL servers being controlled by
+# $my_progname. Here is an example how to do it:
+#
+# GRANT SHUTDOWN ON *.* TO multi_admin\@localhost IDENTIFIED BY 'password'
+#
+# You will need to apply the above to all MySQL servers that are being
+# controlled by $my_progname. 'multi_admin' will shutdown the servers
+# using 'mysqladmin' -binary, when '$my_progname stop' is being called.
+#
+# 2.PID-FILE
+#
+# If you are using mysqld_safe to start mysqld, make sure that every
+# MySQL server has a separate pid-file. In order to use mysqld_safe
+# via $my_progname, you need to use two options:
+#
+# mysqld=/path/to/mysqld_safe
+# ledir=/path/to/mysqld-binary/
+#
+# ledir (library executable directory), is an option that only mysqld_safe
+# accepts, so you will get an error if you try to pass it to mysqld directly.
+# For this reason you might want to use the above options within [mysqld#]
+# group directly.
+#
+# 3.DATA DIRECTORY
#
+# It is NOT advised to run many MySQL servers within the same data directory.
+# You can do so, but please make sure to understand and deal with the
+# underlying caveats. In short they are:
+# - Speed penalty
+# - Risk of table/data corruption
+# - Data synchronising problems between the running servers
+# - Heavily media (disk) bound
+# - Relies on the system (external) file locking
+# - Is not applicable with all table types. (Such as InnoDB)
+# Trying so will end up with undesirable results.
+#
+# 4.TCP/IP Port
+#
+# Every server requires one and it must be unique.
+#
+# 5.[mysqld#] Groups
+#
+# In the example below the first and the fifth mysqld group was
+# intentionally left out. You may have 'gaps' in the config file. This
+# gives you more flexibility.
+#
+# 6.MySQL Server User
+#
+# You can pass the user=... option inside [mysqld#] groups. This
+# can be very handy in some cases, but then you need to run $my_progname
+# as UNIX root.
+#
+# 7.A Start-up Manage Script for $my_progname
+#
+# In the recent MySQL distributions you can find a file called
+# mysqld_multi.server.sh. It is a wrapper for $my_progname. This can
+# be used to start and stop multiple servers during boot and shutdown.
+#
+# You can place the file in /etc/init.d/mysqld_multi.server.sh and
+# make the needed symbolic links to it from various run levels
+# (as per Linux/Unix standard). You may even replace the
+# /etc/init.d/mysql.server script with it.
+#
+# Before using, you must create a my.cnf file either in /etc/my.cnf
+# or /root/.my.cnf and add the [mysqld_multi] and [mysqld#] groups.
+#
+# The script can be found from support-files/mysqld_multi.server.sh
+# in MySQL distribution. (Verify the script before using)
+#
+
[mysqld_multi]
mysqld = @bindir@/mysqld_safe
mysqladmin = @bindir@/mysqladmin
-user = root
-password = your_password
+user = multi_admin
+password = my_password
[mysqld2]
socket = /tmp/mysql.sock2
@@ -624,15 +670,18 @@ port = 3307
pid-file = @localstatedir@2/hostname.pid2
datadir = @localstatedir@2
language = @datadir@/mysql/english
-user = john
+user = unix_user1
[mysqld3]
+mysqld = /path/to/safe_mysqld/safe_mysqld
+ledir = /path/to/mysqld-binary/
+mysqladmin = /path/to/mysqladmin/mysqladmin
socket = /tmp/mysql.sock3
port = 3308
pid-file = @localstatedir@3/hostname.pid3
datadir = @localstatedir@3
language = @datadir@/mysql/swedish
-user = monty
+user = unix_user2
[mysqld4]
socket = /tmp/mysql.sock4
@@ -640,16 +689,15 @@ port = 3309
pid-file = @localstatedir@4/hostname.pid4
datadir = @localstatedir@4
language = @datadir@/mysql/estonia
-user = tonu
+user = unix_user3
-
[mysqld6]
socket = /tmp/mysql.sock6
port = 3311
pid-file = @localstatedir@6/hostname.pid6
datadir = @localstatedir@6
language = @datadir@/mysql/japanese
-user = jani
+user = unix_user4
EOF
exit(0);
}
@@ -670,39 +718,43 @@ Description:
$my_progname can be used to start, or stop any number of separate
mysqld processes running in different TCP/IP ports and UNIX sockets.
-This program can read group [mysqld_multi] from my.cnf file.
-You may want to put options mysqld=... and mysqladmin=... there.
-
-The program will search for group(s) named [mysqld#] from my.cnf (or
-the given --config-file=...), where # can be any positive number
-starting from 1. These groups should be the same as the usual [mysqld]
-group (e.g. options to mysqld, see MySQL manual for detailed
-information about this group), but with those port, socket
-etc. options that are wanted for each separate mysqld processes. The
-number in the group name has another function; it can be used for
-starting, stopping, or reporting some specific mysqld servers with
-this program. See the usage and options below for more information.
+$my_progname can read group [mysqld_multi] from my.cnf file. You may
+want to put options mysqld=... and mysqladmin=... there. Since
+version 2.10 these options can also be given under groups [mysqld#],
+which gives more control over different versions. One can have the
+default mysqld and mysqladmin under group [mysqld_multi], but this is
+not mandatory. Please note that if mysqld or mysqladmin is missing
+from both [mysqld_multi] and [mysqld#], a group that is tried to be
+used, $my_progname will abort with an error.
+
+$my_progname will search for groups named [mysqld#] from my.cnf (or
+the given --config-file=...), where '#' can be any positive integer
+starting from 1. These groups should be the same as the regular
+[mysqld] group, but with those port, socket and any other options
+that are to be used with each separate mysqld process. The number
+in the group name has another function; it can be used for starting,
+stopping, or reporting any specific mysqld server.
Usage: $my_progname [OPTIONS] {start|stop|report} [GNR,GNR,GNR...]
or $my_progname [OPTIONS] {start|stop|report} [GNR-GNR,GNR,GNR-GNR,...]
-The GNR above means the group number. You can start, stop or report
-any GNR, or several of them at the same time. (See --example) The GNRs
-list can be comma separated, or a dash combined, of which the latter
-means that all the GNRs between GNR1-GNR2 will be affected. Without
-GNR argument all the found groups will be either started, stopped, or
-reported. Note that you must not have any white spaces in the GNR
-list. Anything after a white space are ignored.
+The GNR means the group number. You can start, stop or report any GNR,
+or several of them at the same time. (See --example) The GNRs list can
+be comma separated or a dash combined. The latter means that all the
+GNRs between GNR1-GNR2 will be affected. Without GNR argument all the
+groups found will either be started, stopped, or reported. Note that
+syntax for specifying GNRs must appear without spaces.
Options:
--config-file=... Alternative config file.
Using: $opt_config_file
---example Give an example of a config file.
+--example Give an example of a config file with extra information.
--help Print this help and exit.
--log=... Log file. Full path to and the name for the log file. NOTE:
If the file exists, everything will be appended.
Using: $opt_log
--mysqladmin=... mysqladmin binary to be used for a server shutdown.
+ Since version 2.10 this can be given within groups [mysqld#]
Using: $mysqladmin
--mysqld=... mysqld binary to be used. Note that you can give mysqld_safe
to this option also. The options are passed to mysqld. Just
@@ -711,18 +763,20 @@ Options:
Please note: Since mysqld_multi version 2.3 you can also
give this option inside groups [mysqld#] in ~/.my.cnf,
where '#' stands for an integer (number) of the group in
- question. This will be recognized as a special option and
+ question. This will be recognised as a special option and
will not be passed to the mysqld. This will allow one to
start different mysqld versions with mysqld_multi.
--no-log Print to stdout instead of the log file. By default the log
file is turned on.
---password=... Password for user for mysqladmin.
+--password=... Password for mysqladmin user.
+--silent Disable warnings.
--tcp-ip Connect to the MySQL server(s) via the TCP/IP port instead
of the UNIX socket. This affects stopping and reporting.
If a socket file is missing, the server may still be
running, but can be accessed only via the TCP/IP port.
By default connecting is done via the UNIX socket.
---user=... MySQL user for mysqladmin. Using: $opt_user
+--user=... mysqladmin user. Using: $opt_user
+--verbose Be more verbose.
--version Print the version number and exit.
EOF
exit(0);
diff --git a/scripts/mysqld_safe.sh b/scripts/mysqld_safe.sh
index 8ad2ee1df4d..b9e7ce21f79 100644
--- a/scripts/mysqld_safe.sh
+++ b/scripts/mysqld_safe.sh
@@ -322,36 +322,26 @@ do
# 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 process won't react on the kill.
- if test -n "$mysql_tcp_port"
- then
- numofproces=`ps xa | grep -v "grep" | grep $ledir/$MYSQLD| grep -c "port=$mysql_tcp_port"`
- else
- numofproces=`ps xa | grep -v "grep" | grep -c $ledir/$MYSQLD`
- fi
+ numofproces=`ps xa | grep -v "grep" | grep "$ledir/$MYSQLD\>" | grep -c "pid-file=$pid_file"`
echo -e "\nNumber of processes running now: $numofproces" | tee -a $err_log
I=1
while test "$I" -le "$numofproces"
do
- if test -n "$mysql_tcp_port"
+ PROC=`ps xa | grep "$ledir/$MYSQLD\>" | grep -v "grep" | grep "pid-file=$pid_file" | sed -n '$p'`
+
+ for T in $PROC
+ do
+ break
+ done
+ # echo "TEST $I - $T **"
+ if kill -9 $T
then
- PROC=`ps xa | grep "$ledir/$MYSQLD\>" | grep -v "grep" | grep "port=$mysql_tcp_port" | sed -n '$p'`
- else
- PROC=`ps xa | grep "$ledir/$MYSQLD\>" | grep -v "grep" | sed -n '$p'`
+ echo "$MYSQLD process hanging, pid $T - killed" | tee -a $err_log
+ else
+ break
fi
-
- for T in $PROC
- do
- break
- done
- # echo "TEST $I - $T **"
- if kill -9 $T
- then
- echo "$MYSQLD process hanging, pid $T - killed" | tee -a $err_log
- else
- break
- fi
- I=`expr $I + 1`
+ I=`expr $I + 1`
done
fi
echo "`date +'%y%m%d %H:%M:%S'` mysqld restarted" | tee -a $err_log
@@ -359,3 +349,4 @@ done
echo "`date +'%y%m%d %H:%M:%S'` mysqld ended" | tee -a $err_log
echo "" | tee -a $err_log
+
diff --git a/scripts/mysqlhotcopy.sh b/scripts/mysqlhotcopy.sh
index fe93aa5a1bc..2cfe91da115 100644
--- a/scripts/mysqlhotcopy.sh
+++ b/scripts/mysqlhotcopy.sh
@@ -8,7 +8,7 @@ use File::Path;
use DBI;
use Sys::Hostname;
use File::Copy;
-use File::Temp;
+use File::Temp qw(tempfile);
=head1 NAME
@@ -39,7 +39,7 @@ WARNING: THIS PROGRAM IS STILL IN BETA. Comments/patches welcome.
# Documentation continued at end of file
-my $VERSION = "1.21";
+my $VERSION = "1.22";
my $opt_tmpdir = $ENV{TMPDIR} || "/tmp";
@@ -77,7 +77,7 @@ Usage: $0 db_name[./table_regex/] [new_db_name | directory]
--record_log_pos=# record slave and master status in specified db.table
--chroot=# base directory of chroot jail in which mysqld operates
- Try \'perldoc $0 for more complete documentation\'
+ Try \'perldoc $0\' for more complete documentation
_OPTIONS
sub usage {
@@ -655,8 +655,8 @@ sub copy_index
}
elsif ($opt{method} =~ /^scp\b/)
{
- my ($fh, $tmp)=tempfile('mysqlhotcopy-XXXXXX', DIR => $opt_tmpdir);
- die "Can\'t create/open file in $opt_tmpdir\n";
+ my ($fh, $tmp)= tempfile('mysqlhotcopy-XXXXXX', DIR => $opt_tmpdir) or
+ die "Can\'t create/open file in $opt_tmpdir\n";
if (syswrite($fh,$buff) != length($buff))
{
die "Error when writing data to $tmp: $!\n";