summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rw-r--r--scripts/Makefile.am28
-rw-r--r--scripts/fill_func_tables.sh234
-rw-r--r--scripts/fill_help_tables.sh581
-rw-r--r--scripts/make_binary_distribution.sh56
-rw-r--r--scripts/make_win_src_distribution.sh59
-rw-r--r--scripts/mysql_config.sh2
-rw-r--r--scripts/mysql_create_system_tables.sh665
-rw-r--r--scripts/mysql_find_rows.sh2
-rw-r--r--scripts/mysql_fix_privilege_tables.sh405
-rw-r--r--scripts/mysql_fix_privilege_tables.sql104
-rw-r--r--scripts/mysql_install_db.sh267
-rw-r--r--scripts/mysql_prepare_privilege_tables_for_5.sql53
-rw-r--r--scripts/mysql_zap.sh6
-rw-r--r--scripts/mysqlaccess.sh3
-rw-r--r--scripts/mysqld_multi.sh385
-rw-r--r--scripts/mysqlhotcopy.sh1
16 files changed, 2185 insertions, 666 deletions
diff --git a/scripts/Makefile.am b/scripts/Makefile.am
index c464c271a55..4158b5a34dc 100644
--- a/scripts/Makefile.am
+++ b/scripts/Makefile.am
@@ -20,7 +20,7 @@ bin_SCRIPTS = @server_scripts@ \
msql2mysql \
mysql_config \
mysql_fix_privilege_tables \
- mysql_fix_extensions \
+ mysql_fix_extensions \
mysql_setpermission \
mysql_secure_installation \
mysql_zap \
@@ -34,7 +34,8 @@ bin_SCRIPTS = @server_scripts@ \
mysql_tableinfo \
mysqld_multi \
make_win_src_distribution \
- make_win_binary_distribution
+ make_win_binary_distribution \
+ mysql_create_system_tables
EXTRA_SCRIPTS = make_binary_distribution.sh \
make_sharedlib_distribution.sh \
@@ -43,7 +44,7 @@ EXTRA_SCRIPTS = make_binary_distribution.sh \
msql2mysql.sh \
mysql_config.sh \
mysql_fix_privilege_tables.sh \
- mysql_fix_extensions.sh \
+ mysql_fix_extensions.sh \
mysql_install_db.sh \
mysql_setpermission.sh \
mysql_secure_installation.sh \
@@ -53,17 +54,19 @@ EXTRA_SCRIPTS = make_binary_distribution.sh \
mysql_convert_table_format.sh \
mysql_find_rows.sh \
mysqlhotcopy.sh \
- mysqldumpslow.sh \
+ mysqldumpslow.sh \
mysql_explain_log.sh \
mysqld_multi.sh \
mysql_tableinfo.sh \
- mysqld_safe.sh
+ mysqld_safe.sh \
+ fill_help_tables.sh \
+ mysql_create_system_tables.sh
EXTRA_DIST = $(EXTRA_SCRIPTS) \
mysqlaccess.conf \
mysqlbug
-pkgdata_DATA = make_binary_distribution make_sharedlib_distribution
+dist_pkgdata_DATA = fill_help_tables.sql mysql_fix_privilege_tables.sql
# mysqlbug should be distributed built so that people can report build
# failures with it.
@@ -73,7 +76,7 @@ CLEANFILES = @server_scripts@ \
msql2mysql \
mysql_config \
mysql_fix_privilege_tables \
- mysql_fix_extensions \
+ mysql_fix_extensions \
mysql_setpermission \
mysql_secure_installation \
mysql_zap \
@@ -83,7 +86,9 @@ CLEANFILES = @server_scripts@ \
mysqlhotcopy \
mysqldumpslow \
mysqld_multi \
- make_win_src_distribution
+ make_win_src_distribution \
+ fill_help_tables \
+ mysql_create_system_tables
SUPERCLEANFILES = mysqlbug
@@ -104,6 +109,7 @@ SUFFIXES = .sh
-e 's!@''libexecdir''@!$(libexecdir)!g' \
-e 's!@''pkglibdir''@!$(pkglibdir)!g' \
-e 's!@''pkgincludedir''@!$(pkgincludedir)!g' \
+ -e 's!@''pkgdatadir''@!$(pkgdatadir)!g' \
-e 's!@''CC''@!@CC@!'\
-e 's!@''CXX''@!@CXX@!'\
-e 's!@''GXX''@!@GXX@!'\
@@ -133,9 +139,15 @@ 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 $@
# Don't update the files from bitkeeper
%::SCCS/s.%
+
+all: fill_help_tables.sql make_win_src_distribution make_binary_distribution make_sharedlib_distribution
+
+fill_help_tables.sql: fill_help_tables ../Docs/manual.texi
+ ./fill_help_tables < ../Docs/manual.texi > fill_help_tables.sql
diff --git a/scripts/fill_func_tables.sh b/scripts/fill_func_tables.sh
new file mode 100644
index 00000000000..459afee2fe1
--- /dev/null
+++ b/scripts/fill_func_tables.sh
@@ -0,0 +1,234 @@
+#!/usr/bin/perl
+# fill_func_tables - parse ../Docs/manual.texi
+
+# Original version by vva
+
+my $cat_name= "";
+my $func_name= "";
+my $text= "";
+my $example= "";
+
+local $mode= "";
+
+sub prepare_name
+{
+ my ($a)= @_;
+
+ $a =~ s/(\@itemize \@bullet)/ /g;
+ $a =~ s/(\@end itemize)/ /g;
+ $a =~ s/(\@end multitable)/ /g;
+ $a =~ s/(\@end table)/ /g;
+ $a =~ s/(\@cindex(.*?)\n)/ /g;
+ $a =~ s/(\@multitable \@columnfractions(.*?)\n)/ /g;
+ $a =~ s/(\@node(.*?)\n)/ /g;
+ $a =~ s/(\@tab)/\t/g;
+ $a =~ s/\@item/ /g;
+ $a =~ s/\@code\{((.|\n)+?)\}/$1/go;
+ $a =~ s/\@strong\{(.+?)\}/$1/go;
+ $a =~ s/\@samp\{(.+?)\}/$1/go;
+ $a =~ s/\@emph\{((.|\n)+?)\}/\/$1\//go;
+ $a =~ s/\@xref\{((.|\n)+?)\}/See also : [$1]/go;
+ $a =~ s/\@ref\{((.|\n)+?)\}/[$1]/go;
+ $a =~ s/\'/\'\'/g;
+ $a =~ s/\\/\\\\/g;
+ $a =~ s/\`/\`\`/g;
+
+ $a =~ s/\@table \@code/ /g;
+
+ $a =~ s/\(\)//g;
+
+ $a =~ s/((\w|\s)+)\(([\+-=><\/%*!<>\s]+)\)/$3/gxs; #$a =~ s/((\w|\s)+)\(([\+-=><\/%*!<>\s]+)\)/$3 $1/gxs;
+ $a =~ s/([\+-=><\/%*!<>\s]+)\(((\w|\s)+)\)/$1/gxs;#$a =~ s/([\+-=><\/%*!<>\s]+)\(((\w|\s)+)\)/$1 $2/gxs;
+ $a =~ s/((\w|\s)+)\((.+)\)/$1/gxs;
+
+ return $a;
+}
+
+sub prepare_text
+{
+ my ($a)= @_;
+
+ $a =~ s/(\@itemize \@bullet)/ /g;
+ $a =~ s/(\@end itemize)/ /g;
+ $a =~ s/(\@end multitable)/ /g;
+ $a =~ s/(\@end table)/ /g;
+ $a =~ s/(\@cindex(.*?)\n)/ /g;
+ $a =~ s/(\@multitable \@columnfractions(.*?)\n)/ /g;
+ $a =~ s/(\@node(.*?)\n)/ /g;
+ $a =~ s/(\@tab)/\t/g;
+ $a =~ s/\@itemx/ /g;
+ $a =~ s/\@item/ /g;
+ $a =~ s/\@code\{((.|\n)+?)\}/$1/go;
+ $a =~ s/\@strong\{(.+?)\}/$1/go;
+ $a =~ s/\@samp\{(.+?)\}/$1/go;
+ $a =~ s/\@emph\{((.|\n)+?)\}/\/$1\//go;
+ $a =~ s/\@xref\{((.|\n)+?)\}/See also : [$1]/go;
+ $a =~ s/\@ref\{((.|\n)+?)\}/[$1]/go;
+ $a =~ s/\'/\'\'/g;
+ $a =~ s/\\/\\\\/g;
+ $a =~ s/\`/\`\`/g;
+ $a =~ s/(\n*?)$//g;
+ $a =~ s/\n/\\n/g;
+
+ $a =~ s/\@table \@code/ /g;
+
+ return $a;
+}
+
+sub prepare_example
+{
+ my ($a)= @_;
+
+ $a =~ s/\'/\'\'/g;
+ $a =~ s/\\/\\\\/g;
+ $a =~ s/\`/\`\`/g;
+ $a =~ s/(\n*?)$//g;
+ $a =~ s/\n/\\n/g;
+
+ return $a;
+}
+
+sub flush_all
+{
+ my ($mode) = @_;
+
+ if ($mode eq ""){return;}
+
+ $func_name= prepare_name($func_name);
+ $text= prepare_text($text);
+ $example= prepare_example($example);
+
+ if ($func_name ne "" && $text ne "" && !($func_name =~ /[abcdefghikjlmnopqrstuvwxyz]/)){
+ print "INSERT INTO function (name,description,example) VALUES (";
+ print "'$func_name',";
+ print "'$text',";
+ print "'$example'";
+ print ");\n";
+ print "INSERT INTO function_category (cat_id,func_id) VALUES (\@cur_category,LAST_INSERT_ID());\n";
+ }
+
+ $func_name= "";
+ $text= "";
+ $example= "";
+ $mode= "";
+}
+
+sub new_category
+{
+ my ($category)= @_;
+
+ $category= prepare_text($category);
+
+ print "INSERT INTO function_category_name (name) VALUES (\'$category\');\n";
+ print "SELECT \@cur_category:=LAST_INSERT_ID();\n";
+}
+
+print "INSERT INTO db (Host,DB,User,Select_priv) VALUES ('%','mysql_help','','Y');\n";
+print "CREATE DATABASE mysql_help;\n";
+
+print "USE mysql_help;\n";
+
+print "DROP TABLE IF EXISTS function;\n";
+print "CREATE TABLE function (";
+print " func_id int unsigned not null auto_increment,";
+print " name varchar(64) not null,";
+print " url varchar(128) not null,";
+print " description text not null,";
+print " example text not null,";
+print " min_args tinyint not null,";
+print " max_args tinyint,";
+print " date_created datetime not null,";
+print " last_modified timestamp not null,";
+print " primary key (func_id)";
+print ") type=myisam;\n\n";
+
+print "DROP TABLE IF EXISTS function_category_name;\n";
+print "CREATE TABLE function_category_name (";
+print " cat_id smallint unsigned not null auto_increment,";
+print " name varchar(64) not null,";
+print " url varchar(128) not null,";
+print " date_created datetime not null,";
+print " last_modified timestamp not null,";
+print " primary key (cat_id)";
+print ") type=myisam;\n\n";
+
+print "DROP TABLE IF EXISTS function_category;\n";
+print "CREATE TABLE function_category (";
+print " cat_id smallint unsigned not null references function_category_name,";
+print " func_id int unsigned not null references function,";
+print " primary key (cat_id, func_id)";
+print ") type=myisam;\n\n";
+
+print "DELETE FROM function_category_name;\n";
+print "DELETE FROM function_category;\n";
+print "DELETE FROM function;\n";
+print "SELECT \@cur_category:=null;\n\n";
+
+my $in_section_6_3= 0;
+
+for(<>)
+{
+ if ($_=~/\@section Functions for Use in \@code{SELECT} and \@code{WHERE} Clauses/ &&
+ !$in_section_6_3){
+ $in_section_6_3= 1;
+ next;
+ }
+
+ if ($_=~/\@section/ && $in_section_6_3){
+ $in_section_6_3= 0;
+ next;
+ }
+
+ if (!$in_section_6_3) { next; }
+
+ my $c_name= "";
+
+ ($c_name)=m|\@c for_mysql_help,(.+?)$|;
+ if (!($c_name eq "") && ! ($c_name =~ m/$cat_name/i)){
+ ($cat_name)= $c_name;
+ new_category($cat_name);
+ next;
+ }
+
+ ($c_name)=m|\@subsubsection (.+?)$|;
+ if (!($c_name eq "") && ! ($c_name =~ m/$cat_name/i)){
+ ($cat_name)= $c_name;
+ new_category($cat_name);
+ next;
+ }
+
+ ($c_name)=m|\@subsection (.+?)$|;
+ if (!($c_name eq "") && ! ($c_name =~ m/$cat_name/i)){
+ ($cat_name)= $c_name;
+ new_category($cat_name);
+ next;
+ }
+
+ ($f_name)=m|\@findex (.+?)$|;
+ if (!($f_name eq "")){
+ flush_all($mode);
+ ($func_name)= ($f_name);
+ $mode= "text";
+ next;
+ }
+
+ if ($_=~/\@example/ && ($mode eq "text")){
+ $mode= "example";
+ next;
+ }
+
+ if ($_=~/\@end example/ && ($mode eq "example")){
+ flush_all($mode);
+ next;
+ }
+
+ if ($mode eq "text") { $text .= $_; }
+ if ($mode eq "example") { $example .= $_; }
+}
+
+
+print "DELETE function_category_name ";
+print "FROM function_category_name ";
+print "LEFT JOIN function_category ON function_category.cat_id=function_category_name.cat_id ";
+print "WHERE function_category.cat_id is null;"
+
diff --git a/scripts/fill_help_tables.sh b/scripts/fill_help_tables.sh
new file mode 100644
index 00000000000..78dfe7b6088
--- /dev/null
+++ b/scripts/fill_help_tables.sh
@@ -0,0 +1,581 @@
+#!@PERL@
+#
+# Copyright (C) 2003 MySQL AB
+# For a more info consult the file COPYRIGHT distributed with this file.
+#
+# This script generates the SQL statements required by mysql_install_db to
+# fill up the tables for the server-side online function help, which can be
+# invoked with "help <function>" from the MySQL client.
+#
+# Usage:
+# fill_help_tables OPTIONS < manual.texi > fill_help_tables.sql
+#
+# --help display this helpscreen and exit
+# --verbose print information about help completeness to STDERR
+# --lexems=path path to file with lexems. it is used with verbose option.
+# default value is ../sql/lex.h
+# Examples:
+# ./fill_help_tables --help
+# ./fill_help_tables --verbose < manual.texi > fill_help_tables.sql
+# ./fill_help_tables < manual.texi > fill_help_tables.sql
+#
+# Please note, that you first need to update Docs/manual.texi with the
+# manual file from the separate "mysqldoc" BitKeeper-Tree! The manual.texi
+# included in the source tree is just an empty stub file - the full manual
+# is now maintained in a separate tree.
+#
+# extra tags in manual.texi:
+#
+# @c help_category <category_name>[@<parent_category_name>]
+#
+# @c description_for_help_topic <topic_name> <keyword1> <keyword2>
+# ....
+# @c end_description_for_help_topic
+#
+# @c example_for_help_topic <topic_name>
+# @example
+# ....
+# @end example
+#
+#
+# Original version by Victor Vagin <vva@mysql.com>
+#
+
+use strict;
+use Getopt::Long;
+
+my $insert_portion_size= 15;
+my $error_prefix= "---- help parsing errors :";
+
+my $path_to_lex_file= "../sql/lex.h";
+my $verbose_option= 0;
+my $help_option= 0;
+
+my $cur_line= 0;
+my $count_errors= 0;
+
+GetOptions(
+ "help",\$help_option,
+ "verbose",\$verbose_option,
+ "lexems=s",\$path_to_lex_file
+);
+
+if ($help_option ne 0)
+{
+ print <<_HELP;
+
+This script generates the SQL statements required by mysql_install_db to
+fill up the tables for the server-side online function help, which can be
+invoked with "help <function>" from the MySQL client.
+
+Usage:
+ fill_help_tables OPTIONS < manual.texi > fill_help_tables.sql
+
+ --help display this helpscreen and exit
+ --verbose print information about help completeness to STDERR
+ --lexems=path path to file with lexems. it is used with verbose option.
+ default value is ../sql/lex.h
+
+Examples:
+ ./fill_help_tables --help
+ ./fill_help_tables --verbose < manual.texi > fill_help_tables.sql
+ ./fill_help_tables < manual.texi > fill_help_tables.sql
+
+_HELP
+ exit;
+}
+
+my $current_category= "";
+my $current_parent_category= "";
+my $next_example_for_topic= "";
+
+my %topics;
+my %categories;
+my %keywords;
+
+$categories{Contents}->{__parent_category__}= "";
+
+sub print_error
+{
+ my ($text)= @_;
+ if ($count_errors==0)
+ {
+ print STDERR "$error_prefix\n";
+ }
+ print STDERR "line $cur_line : $text";
+ $count_errors++;
+}
+
+sub add_topic_to_category
+{
+ my ($topic_name)= @_;
+
+ $categories{$current_category}->{$topic_name}= $topics{$topic_name};
+ my $category= $categories{$current_category};
+ $category->{__name__}= $current_category;
+
+ if (exists($category->{__parent_category__}))
+ {
+ my $old_parent= $category->{__parent_category__};
+ if ($old_parent ne $current_parent_category)
+ {
+ print_error "wrong parent for $current_category\n";
+ }
+ }
+
+ if ($current_parent_category ne "")
+ {
+ $category->{__parent_category__}= $current_parent_category;
+ }
+
+ if (exists($topics{$topic_name}->{category}))
+ {
+ my $old_category= $topics{$topic_name}->{category};
+ if ($old_category ne $category)
+ {
+ print_error "wrong category for $topic_name (first one's \"$old_category->{__name__}\" second one's \"$current_category\")\n";
+ }
+ }
+
+ $topics{$topic_name}->{category}= $category;
+}
+
+sub add_example
+{
+ my ($topic_name,$example)= @_;
+
+ $topic_name=~ tr/a-z/A-Z/;
+
+ if (exists($topics{$topic_name}->{example}))
+ {
+ print_error "double example for $topic_name\n";
+ }
+
+ $topics{$topic_name}->{example}= $example;
+ add_topic_to_category($topic_name);
+}
+
+sub add_description
+{
+ my ($topic_name,$description)= @_;
+
+ $topic_name=~ tr/a-z/A-Z/;
+
+ if (exists($topics{$topic_name}->{description}))
+ {
+ print_error "double description for $topic_name\n";
+ }
+ $topics{$topic_name}->{description}= $description;
+ add_topic_to_category($topic_name);
+}
+
+sub add_keyword
+{
+ my ($topic_name,$keyword)= @_;
+
+ $topic_name=~ tr/a-z/A-Z/;
+ $keyword=~ tr/a-z/A-Z/;
+
+ push(@{$topics{$topic_name}->{keywords}},$keyword);
+ if (exists($keywords{$keyword}->{$topic_name}))
+ {
+ print_error "double keyword $keyword for $topic_name\n";
+ }
+ $keywords{$keyword}->{$topic_name}= $topics{$topic_name};
+}
+
+sub prepare_name
+{
+ my ($a)= @_;
+
+ $a =~ s/(\@itemize \@bullet)/ /g;
+ $a =~ s/(\@end itemize)/ /g;
+ $a =~ s/(\@end multitable)/ /g;
+ $a =~ s/(\@end table)/ /g;
+ $a =~ s/(\@cindex(.*?)\n)/ /g;
+ $a =~ s/(\@multitable \@columnfractions(.*?)\n)/ /g;
+ $a =~ s/(\@node(.*?)\n)/ /g;
+ $a =~ s/(\@tab)/\t/g;
+ $a =~ s/\@item/ /g;
+ $a =~ s/\@minus\{\}/-/g;
+ $a =~ s/\@dots\{\}/.../g;
+ $a =~ s/\@var\{((.|\n)+?)\}/$1/go;
+ $a =~ s/\@command\{((.|\n)+?)\}/$1/go;
+ $a =~ s/\@code\{((.|\n)+?)\}/$1/go;
+ $a =~ s/\@strong\{(.+?)\}/$1/go;
+ $a =~ s/\@samp\{(.+?)\}/$1/go;
+ $a =~ s/\@emph\{((.|\n)+?)\}/\/$1\//go;
+ $a =~ s/\@xref\{((.|\n)+?)\}/See also : [$1]/go;
+ $a =~ s/\@ref\{((.|\n)+?)\}/[$1]/go;
+ $a =~ s/\'/\'\'/g;
+ $a =~ s/\\/\\\\/g;
+ $a =~ s/\`/\`\`/g;
+
+ $a =~ s/\@table \@code/ /g;
+ $a =~ s/\(\)//g;
+ $a =~ s/\"/\\\"/g;
+
+ $a =~ s/((\w|\s)+)\(([\+-=><\/%*!<>\s]+)\)/$3/gxs;
+ $a =~ s/([\+-=><\/%*!<>\s]+)\(((\w|\s)+)\)/$1/gxs;
+ $a =~ s/((\w|\s)+)\((.+)\)/$1/gxs;
+
+ $a =~ s/((\s)+)$//g;
+
+ return $a;
+}
+
+sub prepare_description
+{
+ my ($a)= @_;
+
+ $a =~ s/(\@itemize \@bullet\n)//g;
+ $a =~ s/(\@c help_keyword (.*?)\n)//g;
+ $a =~ s/(\@end itemize\n)//g;
+ $a =~ s/(\@end example\n)//g;
+ $a =~ s/(\@example\n)//g;
+ $a =~ s/(\@{)/{/g;
+ $a =~ s/(\@})/}/g;
+ $a =~ s/(\@end multitable)/ /g;
+ $a =~ s/(\@end table)/ /g;
+ $a =~ s/(\@cindex(.*?)\n)//g;
+ $a =~ s/(\@findex(.*?)\n)//g;
+ $a =~ s/(\@table(.*?)\n)//g;
+ $a =~ s/(\@multitable \@columnfractions(.*?)\n)/ /g;
+ $a =~ s/(\@node(.*?)\n)/ /g;
+ $a =~ s/(\@tab)/\t/g;
+ $a =~ s/\@itemx/ /g;
+ $a =~ s/(\@item\n(\s*?))(\S)/ --- $3/g;
+ $a =~ s/(\@item)/ /g;
+ $a =~ s/(\@tindex\s(.*?)\n)//g;
+ $a =~ s/(\@c\s(.*?)\n)//g;
+ $a =~ s/\@minus\{\}/-/g;
+ $a =~ s/\@dots\{\}/.../g;
+ $a =~ s/\@var\{((.|\n)+?)\}/$1/go;
+ $a =~ s/\@command\{((.|\n)+?)\}/$1/go;
+ $a =~ s/\@code\{((.|\n)+?)\}/$1/go;
+ $a =~ s/\@strong\{(.+?)\}/$1/go;
+ $a =~ s/\@samp\{(.+?)\}/$1/go;
+ $a =~ s/\@emph\{((.|\n)+?)\}/\/$1\//go;
+ $a =~ s/\@xref\{((.|\n)+?)\}/See also : [$1]/go;
+ $a =~ s/\@ref\{((.|\n)+?)\}/[$1]/go;
+ $a =~ s/\@w\{((.|\n)+?)\}/$1/go;
+ $a =~ s/\@strong\{((.|\n)+?)\}/\n!!!!\n$1\n!!!!\n/go;
+ $a =~ s/\@file\{((.|\n)+?)\}/\*$1/go;
+ $a =~ s/\\/\\\\/g;
+ $a =~ s/\n\n$/\n/g;
+ $a =~ s/\n\n$/\n/g;
+ $a =~ s/\n\n$/\n/g;
+ $a =~ s/\n\n$/\n/g;
+ $a =~ s/\n\n$/\n/g;
+ $a =~ s/\n/\\n/g;
+ $a =~ s/\"/\\\"/g;
+
+ $a =~ s/\@table \@code/ /g;
+
+ return $a;
+}
+
+sub prepare_example
+{
+ my ($a)= @_;
+
+ $a =~ s/(^\@c for_help_topic(.*?)\n)//g;
+
+ $a =~ s/\@var\{((.|\n)+?)\}/$1/go;
+ $a =~ s/\@dots\{\}/.../g;
+ $a =~ s/\\/\\\\/g;
+ $a =~ s/(\@{)/{/g;
+ $a =~ s/(\@})/}/g;
+ $a =~ s/(\@\@)/\@/g;
+ $a =~ s/(\n*?)$//g;
+ $a =~ s/\n/\\n/g;
+ $a =~ s/\"/\\\"/g;
+
+ return $a;
+}
+
+sub parse_example
+{
+ return if (!($_=~/\@example/));
+ return if ($next_example_for_topic eq "");
+
+ my $topic_name= $next_example_for_topic;
+ $next_example_for_topic= "";
+ my $text= "";
+
+ while (<>)
+ {
+ $cur_line++;
+ last if ($_=~/\@end example/);
+ $text .= $_;
+ }
+
+ $text= prepare_example($text);
+ $topic_name= prepare_name($topic_name);
+ add_example($topic_name,$text) if ($topic_name ne "");
+}
+
+sub parse_example_for_topic
+{
+ my ($for_topic)= m|\@c example_for_help_topic (.+?)$|;
+ return if ($for_topic eq "");
+
+ $next_example_for_topic= $for_topic;
+}
+
+sub parse_description
+{
+ my ($topic_description)= m|\@c description_for_help_topic (.+?)$|;
+ return if ($topic_description eq "");
+
+ my ($topic_name,$topic_keywords)= split(/ /,$topic_description);
+
+ if ($topic_name eq "" || $topic_keywords eq "")
+ {
+ $topic_name= $topic_description;
+ }
+ else
+ {
+ my $keyword;
+ foreach $keyword (split(/ /,$topic_keywords))
+ {
+ add_keyword($topic_name,$keyword) if ($keyword ne "");
+ }
+ }
+
+ my $text= "";
+
+ while (<>)
+ {
+ $cur_line++;
+ last if ($_=~/\@c end_description_for_help_topic/);
+ $text .= $_;
+ }
+
+ $text= prepare_description($text);
+ $topic_name= prepare_name($topic_name);
+ add_description($topic_name,$text);
+}
+
+sub parse_category
+{
+ my ($c_name,$pc_name)= m|\@c help_category (.+?)\@(.+?)$|;
+
+ if ($pc_name ne "")
+ {
+ $current_category= prepare_name($c_name);
+ $current_parent_category= prepare_name($pc_name);
+ }
+ else
+ {
+ my ($c_name)=m|\@c help_category (.+?)$|;
+ return if ($c_name eq "");
+
+ $current_category= prepare_name($c_name);
+ $current_parent_category= "Contents"
+ }
+}
+
+# parse manual:
+
+while (<>)
+{
+ parse_example_for_topic ();
+ parse_example ();
+ parse_description ();
+ parse_category ();
+ $cur_line++;
+}
+
+# test results of parsing:
+
+sub print_bad_names
+{
+ my($names,$prompt)= @_;
+ if (scalar(@{$names}))
+ {
+ print STDERR "\n-------------- $prompt : \n\n";
+ my $name;
+ foreach $name (@{$names})
+ {
+ print STDERR "$name\n";
+ }
+ print STDERR "\n";
+ }
+}
+
+sub print_verbose_errors
+{
+ my($name_of_log_file)= @_;
+
+ my @without_help;
+ my @description_with_at;
+ my @example_with_at;
+ my @without_description;
+ my @without_example;
+
+ print STDERR "\n-------------- parameters of help completeness : \n\n";
+
+ my $count_lex= 0;
+ if (!open (TLEX,"<$path_to_lex_file"))
+ {
+ print STDERR "Error opening lex file \"$path_to_lex_file\" $!\n";
+ }
+ else
+ {
+ for (<TLEX>)
+ {
+ my ($a,$lex,$b)=m|(.+?)\"(.+?)\"(.+?)$|;
+ next if ($lex eq "");
+ $count_lex++;
+ next if (exists($topics{$lex}) || exists($keywords{$lex}));
+ push(@without_help,$lex);
+ }
+ close(TLEX);
+ print STDERR "number of lexems in \"$path_to_lex_file\" - $count_lex\n";
+ }
+
+ my $name;
+ my @topic_names= keys(%topics);
+ foreach $name (@topic_names)
+ {
+ my $topic= $topics{$name};
+ push(@description_with_at,$name) if ($topic->{description}=~/\@/);
+ push(@example_with_at,$name) if ($topic->{example}=~/\@/);
+ push(@without_description,$name) if (!exists($topic->{description}));
+ push(@without_example,$name) if (!exists($topic->{example}));
+ }
+
+ my $count_categories= scalar(keys(%categories));
+ print STDERR "number of help categories - ",$count_categories,"\n";
+ my $count_topics= scalar(@topic_names);
+ print STDERR "number of help topics - ",$count_topics,"\n";
+ my $count_keywords= scalar(keys(%keywords));
+ print STDERR "number of help keywords - ",$count_keywords,"\n";
+
+ my $count_without_help= scalar(@without_help);
+ print_bad_names(\@without_help,"lexems without help (".
+ $count_without_help." ~ ".
+ (int (($count_without_help/$count_lex)*100)).
+ "%)");
+ print_bad_names(\@description_with_at,
+ " topics below have symbol \'@\' in their descriptions.\n".
+ "it's probably the litter from 'texi' tags (script needs fixing)");
+ print_bad_names(\@example_with_at,
+ " topics below have symbol \'@\' in their examples.\n".
+ "it's probably the litter from 'texi' tags (script needs fixing)");
+ print_bad_names(\@without_description,"topics without description");
+
+ my $count_without_example= scalar(@without_example);
+ print_bad_names(\@without_example,"topics without example (".
+ $count_without_example." ~ ".
+ (int (($count_without_example/$count_topics)*100)).
+ "%)");
+}
+
+print_verbose_errors if ($verbose_option ne 0);
+
+# output result
+
+sub print_insert_header
+{
+ my($count,$header)= @_;
+
+ if ($count % $insert_portion_size ne 0) {
+ print ",";
+ } else {
+ print ";\n" if ($count ne 0);
+ print "$header";
+ }
+}
+
+print "delete from help_topic;\n";
+print "delete from help_category;\n";
+print "delete from help_keyword;\n";
+print "delete from help_relation;\n\n";
+
+my @category_names= keys(%categories);
+if (scalar(@category_names))
+{
+ my $cat_name;
+ my $count= 0;
+ foreach $cat_name (@category_names)
+ {
+ $categories{$cat_name}->{__id__}= $count;
+ $count++;
+ }
+
+ my $header= "insert into help_category ".
+ "(help_category_id,name,parent_category_id) values ";
+ $count= 0;
+ foreach $cat_name (@category_names)
+ {
+ print_insert_header($count,$header);
+ my $parent_cat_name= $categories{$cat_name}->{__parent_category__};
+ my $parent_cat_id= $parent_cat_name eq ""
+ ? "-1" : $categories{$parent_cat_name}->{__id__};
+ print "($count,\"$cat_name\",$parent_cat_id)";
+ $count++;
+ }
+ printf ";\n\n";
+}
+
+my @topic_names= keys(%topics);
+if (scalar(@topic_names))
+{
+ my $header= "insert into help_topic ".
+ "(help_topic_id,help_category_id,name,description,example) values ";
+ my $topic_name;
+ my $count= 0;
+ foreach $topic_name (@topic_names)
+ {
+ print_insert_header($count,$header);
+ my $topic= $topics{$topic_name};
+ print "($count,";
+ print "$topic->{category}->{__id__},";
+ print "\"$topic_name\",";
+ print "\"$topic->{description}\",";
+ print "\"$topic->{example}\")";
+ $topics{$topic_name}->{__id__}= $count;
+ $count++;
+ }
+ printf ";\n\n";
+}
+
+my @keywords_names= keys(%keywords);
+if (scalar(@keywords_names))
+{
+ my $header= "insert into help_keyword (help_keyword_id,name) values ";
+ my $keyword_name;
+ my $count= 0;
+ foreach $keyword_name (@keywords_names)
+ {
+ print_insert_header($count,$header);
+ print "($count,\"$keyword_name\")";
+ $count++;
+ }
+ printf ";\n\n";
+
+ $header= "insert into help_relation ".
+ "(help_topic_id,help_keyword_id) values ";
+ $count= 0;
+ my $count_keyword= 0;
+ foreach $keyword_name (@keywords_names)
+ {
+ my $topic_name;
+ foreach $topic_name (keys(%{$keywords{$keyword_name}}))
+ {
+ print_insert_header($count,$header);
+ print "($topics{$topic_name}->{__id__},$count_keyword)";
+ $count++;
+ }
+ $count_keyword++;
+ }
+ printf ";\n\n";
+}
+
+if ($count_errors)
+{
+ print STDERR "$count_errors errors !!!\n";
+ exit 1;
+}
diff --git a/scripts/make_binary_distribution.sh b/scripts/make_binary_distribution.sh
index 8ea9a16f56b..281ef9bd469 100644
--- a/scripts/make_binary_distribution.sh
+++ b/scripts/make_binary_distribution.sh
@@ -17,6 +17,7 @@ DEBUG=0
SILENT=0
TMP=/tmp
SUFFIX=""
+NDBCLUSTER=
parse_arguments() {
for arg do
@@ -26,6 +27,7 @@ parse_arguments() {
--suffix=*) SUFFIX=`echo "$arg" | sed -e "s;--suffix=;;"` ;;
--no-strip) STRIP=0 ;;
--silent) SILENT=1 ;;
+ --with-ndbcluster) NDBCLUSTER=1 ;;
*)
echo "Unknown argument '$arg'"
exit 1
@@ -101,7 +103,7 @@ BIN_FILES="extra/comp_err$BS extra/replace$BS extra/perror$BS \
isam/isamchk$BS isam/pack_isam$BS \
myisam/myisamchk$BS myisam/myisampack$BS myisam/myisamlog$BS \
myisam/myisam_ftdump$BS \
- sql/mysqld$BS \
+ sql/mysqld$BS sql/mysql_tzinfo_to_sql$BS \
client/mysql$BS client/mysqlshow$BS client/mysqladmin$BS \
client/mysqldump$BS client/mysqlimport$BS \
client/mysqltest$BS client/mysqlcheck$BS \
@@ -185,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
@@ -193,14 +195,7 @@ if [ $BASE_SYSTEM != "netware" ] ; then
fi
$CP support-files/* $BASE/support-files
-
-if [ $BASE_SYSTEM = "netware" ] ; then
- 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
-fi
+$CP scripts/*.sql $BASE/share
$CP -r sql/share/* $MYSQL_SHARE
rm -f $MYSQL_SHARE/Makefile* $MYSQL_SHARE/*/*.OLD
@@ -216,7 +211,7 @@ do
done
$CP mysql-test/include/*.inc $BASE/mysql-test/include
-$CP mysql-test/std_data/*.dat mysql-test/std_data/*.001 $BASE/mysql-test/std_data
+$CP mysql-test/std_data/*.dat mysql-test/std_data/*.*001 $BASE/mysql-test/std_data
$CP mysql-test/std_data/des_key_file $BASE/mysql-test/std_data
$CP mysql-test/t/*test mysql-test/t/*.opt mysql-test/t/*.slave-mi mysql-test/t/*.sh $BASE/mysql-test/t
$CP mysql-test/r/*result mysql-test/r/*.require $BASE/mysql-test/r
@@ -224,23 +219,38 @@ $CP mysql-test/r/*result mysql-test/r/*.require $BASE/mysql-test/r
if [ $BASE_SYSTEM != "netware" ] ; then
chmod a+x $BASE/bin/*
$CP scripts/* $BASE/bin
- $BASE/bin/replace \@localstatedir\@ ./data \@bindir\@ ./bin \@scriptdir\@ ./bin \@libexecdir\@ ./bin \@sbindir\@ ./bin \@prefix\@ . \@HOSTNAME\@ @HOSTNAME@ < $SOURCE/scripts/mysql_install_db.sh > $BASE/scripts/mysql_install_db
+ $BASE/bin/replace \@localstatedir\@ ./data \@bindir\@ ./bin \@scriptdir\@ ./bin \@libexecdir\@ ./bin \@sbindir\@ ./bin \@prefix\@ . \@HOSTNAME\@ @HOSTNAME@ \@pkgdatadir\@ ./support-files < $SOURCE/scripts/mysql_install_db.sh > $BASE/scripts/mysql_install_db
$BASE/bin/replace \@prefix\@ /usr/local/mysql \@bindir\@ ./bin \@MYSQLD_USER\@ root \@localstatedir\@ /usr/local/mysql/data \@HOSTNAME\@ @HOSTNAME@ < $SOURCE/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-* $BASE/support-files/mysql.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/setsomevars $BASE/support-files/Makefile* $BASE/support-files/*.sh
#
+# Copy system dependent files
+#
+if [ $BASE_SYSTEM = "netware" ] ; then
+ cp ./netware/static_init_db.sql ./netware/init_db.sql
+ ./scripts/fill_help_tables < ./Docs/manual.texi >> ./netware/init_db.sql
+fi
+
+#
# Remove system dependent files
#
if [ $BASE_SYSTEM = "netware" ] ; then
- rm -f $BASE/MySQLEULA.txt
+ 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/INSTALL-BINARY \
+ $BASE/MySQLEULA.txt
else
rm -f $BASE/README.NW
fi
@@ -255,6 +265,18 @@ if [ -d $BASE/sql-bench/SCCS ] ; then
find $BASE/sql-bench -name SCCS -print | xargs rm -r -f
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 )
+ $CP $BASE/ndb-stage@bindir@/* $BASE/bin/.
+ $CP $BASE/ndb-stage@libexecdir@/* $BASE/bin/.
+ $CP $BASE/ndb-stage@pkglibdir@/* $BASE/lib/.
+ $CP -r $BASE/ndb-stage@pkgincludedir@/ndb $BASE/lib/.
+ $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-$system-$machine$SUFFIX
BASE2=$TMP/$NEW_NAME
@@ -331,9 +353,6 @@ if [ $BASE_SYSTEM != "netware" ] ; then
echo "Compressing archive"
rm -f $NEW_NAME.tar.gz
gzip -9 $NEW_NAME.tar
- echo "Removing temporary directory"
- rm -r -f $BASE
-
echo "$NEW_NAME.tar.gz created"
else
@@ -344,9 +363,8 @@ else
cd $TMP
if test -e "$SOURCE/$NEW_NAME.zip"; then rm $SOURCE/$NEW_NAME.zip; fi
zip -r $SOURCE/$NEW_NAME.zip $NEW_NAME
- echo "Removing temporary directory"
- rm -r -f $BASE
-
echo "$NEW_NAME.zip created"
fi
+echo "Removing temporary directory"
+rm -r -f $BASE
diff --git a/scripts/make_win_src_distribution.sh b/scripts/make_win_src_distribution.sh
index 9aca62527e6..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
@@ -161,13 +153,16 @@ vreplace()
done
}
-for d in 4.0.XX-gpl 4.0.XX-pro 4.0.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
+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
@@ -242,7 +237,7 @@ copy_dir_dirs() {
for i in client dbug extra heap include isam \
libmysql libmysqld merge myisam \
- myisammrg mysys regex sql strings \
+ myisammrg mysys regex sql strings sql-common \
tools vio zlib
do
copy_dir_files $i
@@ -278,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 ]
@@ -291,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 ]
@@ -311,9 +310,21 @@ done
# Fix some windows files to avoid compiler warnings
#
-./extra/replace std:: "" -- $BASE/sql/sql_yacc.cpp
+./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
+
+#
+# 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
-unix_to_dos $BASE/README
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_create_system_tables.sh b/scripts/mysql_create_system_tables.sh
new file mode 100644
index 00000000000..f524b322388
--- /dev/null
+++ b/scripts/mysql_create_system_tables.sh
@@ -0,0 +1,665 @@
+#!/bin/sh
+# Copyright (C) 1997-2003 MySQL AB
+# For a more info consult the file COPYRIGHT distributed with this file
+
+# This script writes on stdout SQL commands to generate all not
+# existing MySQL system tables. It also replaces the help tables with
+# new context from the manual (from fill_help_tables.sql).
+
+# $1 - "test" or "real" or "verbose" variant of database
+# $2 - path to mysql-database directory
+# $3 - hostname
+# $4 - windows option
+
+if test "$1" = ""
+then
+ echo "
+This script writes on stdout SQL commands to generate all not
+existing MySQL system tables. It also replaces the help tables with
+new context from the manual (from fill_help_tables.sql).
+
+Usage:
+ mysql_create_system_tables [test|verbose|real] <path to mysql-database directory> <hostname> <windows option>
+"
+ exit
+fi
+
+mdata=$2
+hostname=$3
+windows=$4
+
+# Initialize variables
+c_d="" i_d=""
+c_h="" i_h=""
+c_u="" i_u=""
+c_f="" i_f=""
+c_t="" c_c=""
+c_ht=""
+c_hc=""
+c_hr=""
+c_hk=""
+i_ht=""
+c_tzn="" c_tz="" c_tzt="" c_tztt="" c_tzls=""
+i_tzn="" i_tz="" i_tzt="" i_tztt="" i_tzls=""
+
+# Check for old tables
+if test ! -f $mdata/db.frm
+then
+ if test "$1" = "verbose" ; then
+ echo "Preparing db table" 1>&2;
+ fi
+
+ # mysqld --bootstrap wants one command/line
+ c_d="$c_d CREATE TABLE db ("
+ c_d="$c_d Host char(60) binary DEFAULT '' NOT NULL,"
+ c_d="$c_d Db char(64) binary DEFAULT '' NOT NULL,"
+ c_d="$c_d User char(16) binary DEFAULT '' NOT NULL,"
+ c_d="$c_d Select_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
+ c_d="$c_d Insert_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
+ c_d="$c_d Update_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
+ c_d="$c_d Delete_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
+ c_d="$c_d Create_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
+ c_d="$c_d Drop_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
+ c_d="$c_d Grant_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
+ c_d="$c_d References_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
+ c_d="$c_d Index_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
+ c_d="$c_d Alter_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
+ c_d="$c_d Create_tmp_table_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
+ c_d="$c_d Lock_tables_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
+ c_d="$c_d PRIMARY KEY Host (Host,Db,User),"
+ c_d="$c_d KEY User (User)"
+ c_d="$c_d ) engine=MyISAM"
+ c_d="$c_d CHARACTER SET utf8 COLLATE utf8_bin"
+ c_d="$c_d comment='Database privileges';"
+
+ i_d="INSERT INTO db VALUES ('%','test','','Y','Y','Y','Y','Y','Y','N','Y','Y','Y','Y','Y');
+ INSERT INTO db VALUES ('%','test\_%','','Y','Y','Y','Y','Y','Y','N','Y','Y','Y','Y','Y');"
+fi
+
+if test ! -f $mdata/host.frm
+then
+ if test "$1" = "verbose" ; then
+ echo "Preparing host table" 1>&2;
+ fi
+
+ c_h="$c_h CREATE TABLE host ("
+ c_h="$c_h Host char(60) binary DEFAULT '' NOT NULL,"
+ c_h="$c_h Db char(64) binary DEFAULT '' NOT NULL,"
+ c_h="$c_h Select_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
+ c_h="$c_h Insert_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
+ c_h="$c_h Update_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
+ c_h="$c_h Delete_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
+ c_h="$c_h Create_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
+ c_h="$c_h Drop_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
+ c_h="$c_h Grant_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
+ c_h="$c_h References_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
+ c_h="$c_h Index_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
+ c_h="$c_h Alter_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
+ c_h="$c_h Create_tmp_table_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
+ c_h="$c_h Lock_tables_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
+ c_h="$c_h PRIMARY KEY Host (Host,Db)"
+ c_h="$c_h ) engine=MyISAM"
+ c_h="$c_h CHARACTER SET utf8 COLLATE utf8_bin"
+ c_h="$c_h comment='Host privileges; Merged with database privileges';"
+fi
+
+if test ! -f $mdata/user.frm
+then
+ if test "$1" = "verbose" ; then
+ echo "Preparing user table" 1>&2;
+ fi
+
+ c_u="$c_u CREATE TABLE user ("
+ c_u="$c_u Host char(60) binary DEFAULT '' NOT NULL,"
+ c_u="$c_u User char(16) binary DEFAULT '' NOT NULL,"
+ c_u="$c_u Password char(41) binary DEFAULT '' NOT NULL,"
+ c_u="$c_u Select_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
+ c_u="$c_u Insert_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
+ c_u="$c_u Update_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
+ c_u="$c_u Delete_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
+ c_u="$c_u Create_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
+ c_u="$c_u Drop_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
+ c_u="$c_u Reload_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
+ c_u="$c_u Shutdown_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
+ c_u="$c_u Process_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
+ c_u="$c_u File_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
+ c_u="$c_u Grant_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
+ c_u="$c_u References_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
+ c_u="$c_u Index_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
+ c_u="$c_u Alter_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
+ c_u="$c_u Show_db_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
+ c_u="$c_u Super_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
+ c_u="$c_u Create_tmp_table_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
+ c_u="$c_u Lock_tables_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
+ c_u="$c_u Execute_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
+ c_u="$c_u Repl_slave_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
+ c_u="$c_u Repl_client_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
+ c_u="$c_u ssl_type enum('','ANY','X509', 'SPECIFIED') DEFAULT '' NOT NULL,"
+ c_u="$c_u ssl_cipher BLOB NOT NULL,"
+ c_u="$c_u x509_issuer BLOB NOT NULL,"
+ c_u="$c_u x509_subject BLOB NOT NULL,"
+ c_u="$c_u max_questions int(11) unsigned DEFAULT 0 NOT NULL,"
+ c_u="$c_u max_updates int(11) unsigned DEFAULT 0 NOT NULL,"
+ c_u="$c_u max_connections int(11) unsigned DEFAULT 0 NOT NULL,"
+ c_u="$c_u PRIMARY KEY Host (Host,User)"
+ c_u="$c_u ) engine=MyISAM"
+ c_u="$c_u CHARACTER SET utf8 COLLATE utf8_bin"
+ c_u="$c_u comment='Users and global privileges';"
+
+ if test "$1" = "test"
+ then
+ i_u="INSERT INTO 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','','','','',0,0,0);
+ INSERT INTO user VALUES ('$hostname','root','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0);
+ REPLACE INTO 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','','','','',0,0,0);
+ INSERT INTO user (host,user) values ('localhost','');
+ INSERT INTO user (host,user) values ('$hostname','');"
+ else
+ i_u="INSERT INTO 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','','','','',0,0,0);"
+ if test "$windows" = "0"
+ then
+ i_u="$i_u
+ INSERT INTO user VALUES ('$hostname','root','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0);
+ INSERT INTO user (host,user) values ('$hostname','');
+ INSERT INTO user (host,user) values ('localhost','');"
+ else
+ i_u="$i_u
+ INSERT INTO user VALUES ('%','root','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0);
+ INSERT INTO user VALUES ('localhost','','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0);
+ INSERT INTO user VALUES ('%','','','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','','','','',0,0,0);"
+ fi
+ fi
+fi
+
+if test ! -f $mdata/func.frm
+then
+ if test "$1" = "verbose" ; then
+ echo "Preparing func table" 1>&2;
+ fi
+
+ c_f="$c_f CREATE TABLE func ("
+ c_f="$c_f name char(64) binary DEFAULT '' NOT NULL,"
+ c_f="$c_f ret tinyint(1) DEFAULT '0' NOT NULL,"
+ c_f="$c_f dl char(128) DEFAULT '' NOT NULL,"
+ c_f="$c_f type enum ('function','aggregate') NOT NULL,"
+ c_f="$c_f PRIMARY KEY (name)"
+ c_f="$c_f ) engine=MyISAM"
+ c_f="$c_f CHARACTER SET utf8 COLLATE utf8_bin"
+ c_f="$c_f comment='User defined functions';"
+fi
+
+if test ! -f $mdata/tables_priv.frm
+then
+ if test "$1" = "verbose" ; then
+ echo "Preparing tables_priv table" 1>&2;
+ fi
+
+ c_t="$c_t CREATE TABLE tables_priv ("
+ c_t="$c_t Host char(60) binary DEFAULT '' NOT NULL,"
+ c_t="$c_t Db char(64) binary DEFAULT '' NOT NULL,"
+ c_t="$c_t User char(16) binary DEFAULT '' NOT NULL,"
+ c_t="$c_t Table_name char(64) binary DEFAULT '' NOT NULL,"
+ c_t="$c_t Grantor char(77) DEFAULT '' NOT NULL,"
+ c_t="$c_t Timestamp timestamp(14),"
+ c_t="$c_t Table_priv set('Select','Insert','Update','Delete','Create','Drop','Grant','References','Index','Alter') DEFAULT '' NOT NULL,"
+ c_t="$c_t Column_priv set('Select','Insert','Update','References') DEFAULT '' NOT NULL,"
+ c_t="$c_t PRIMARY KEY (Host,Db,User,Table_name),"
+ c_t="$c_t KEY Grantor (Grantor)"
+ c_t="$c_t ) engine=MyISAM"
+ c_t="$c_t CHARACTER SET utf8 COLLATE utf8_bin"
+ c_t="$c_t comment='Table privileges';"
+fi
+
+if test ! -f $mdata/columns_priv.frm
+then
+ if test "$1" = "verbose" ; then
+ echo "Preparing columns_priv table" 1>&2;
+ fi
+
+ c_c="$c_c CREATE TABLE columns_priv ("
+ c_c="$c_c Host char(60) binary DEFAULT '' NOT NULL,"
+ c_c="$c_c Db char(64) binary DEFAULT '' NOT NULL,"
+ c_c="$c_c User char(16) binary DEFAULT '' NOT NULL,"
+ c_c="$c_c Table_name char(64) binary DEFAULT '' NOT NULL,"
+ c_c="$c_c Column_name char(64) binary DEFAULT '' NOT NULL,"
+ c_c="$c_c Timestamp timestamp(14),"
+ c_c="$c_c Column_priv set('Select','Insert','Update','References') DEFAULT '' NOT NULL,"
+ c_c="$c_c PRIMARY KEY (Host,Db,User,Table_name,Column_name)"
+ c_c="$c_c ) engine=MyISAM"
+ c_c="$c_c CHARACTER SET utf8 COLLATE utf8_bin"
+ c_c="$c_c comment='Column privileges';"
+fi
+
+if test ! -f $mdata/help_topic.frm
+then
+ if test "$1" = "verbose" ; then
+ echo "Preparing help_topic table" 1>&2;
+ fi
+
+ c_ht="$c_ht CREATE TABLE help_topic ("
+ c_ht="$c_ht help_topic_id int unsigned not null,"
+ c_ht="$c_ht name varchar(64) not null,"
+ c_ht="$c_ht help_category_id smallint unsigned not null,"
+ c_ht="$c_ht description text not null,"
+ c_ht="$c_ht example text not null,"
+ c_ht="$c_ht url varchar(128) not null,"
+ c_ht="$c_ht primary key (help_topic_id),"
+ c_ht="$c_ht unique index (name)"
+ c_ht="$c_ht ) engine=MyISAM"
+ c_ht="$c_ht CHARACTER SET utf8"
+ c_ht="$c_ht comment='help topics';"
+fi
+
+old_categories="yes"
+
+if test ! -f $mdata/help_category.frm
+then
+ if test "$1" = "verbose" ; then
+ echo "Preparing help_category table" 1>&2;
+ fi
+
+ c_hc="$c_hc CREATE TABLE help_category ("
+ c_hc="$c_hc help_category_id smallint unsigned not null,"
+ c_hc="$c_hc name varchar(64) not null,"
+ c_hc="$c_hc parent_category_id smallint unsigned null,"
+ c_hc="$c_hc url varchar(128) not null,"
+ c_hc="$c_hc primary key (help_category_id),"
+ c_hc="$c_hc unique index (name)"
+ c_hc="$c_hc ) engine=MyISAM"
+ c_hc="$c_hc CHARACTER SET utf8"
+ c_hc="$c_hc comment='help categories';"
+fi
+
+if test ! -f $mdata/help_keyword.frm
+then
+ if test "$1" = "verbose" ; then
+ echo "Preparing help_keyword table" 1>&2;
+ fi
+
+ c_hk="$c_hk CREATE TABLE help_keyword ("
+ c_hk="$c_hk help_keyword_id int unsigned not null,"
+ c_hk="$c_hk name varchar(64) not null,"
+ c_hk="$c_hk primary key (help_keyword_id),"
+ c_hk="$c_hk unique index (name)"
+ c_hk="$c_hk ) engine=MyISAM"
+ c_hk="$c_hk CHARACTER SET utf8"
+ c_hk="$c_hk comment='help keywords';"
+fi
+
+if test ! -f $mdata/help_relation.frm
+then
+ if test "$1" = "verbose" ; then
+ echo "Preparing help_relation table" 1>&2;
+ fi
+
+ c_hr="$c_hr CREATE TABLE help_relation ("
+ c_hr="$c_hr help_topic_id int unsigned not null references help_topic,"
+ c_hr="$c_hr help_keyword_id int unsigned not null references help_keyword,"
+ c_hr="$c_hr primary key (help_keyword_id, help_topic_id)"
+ c_hr="$c_hr ) engine=MyISAM"
+ c_hr="$c_hr CHARACTER SET utf8"
+ c_hr="$c_hr comment='keyword-topic relation';"
+fi
+
+if test ! -f $mdata/time_zone_name.frm
+then
+ if test "$1" = "verbose" ; then
+ echo "Preparing time_zone_name table" 1>&2;
+ fi
+
+ c_tzn="$c_tzn CREATE TABLE time_zone_name ("
+ c_tzn="$c_tzn Name char(64) NOT NULL,"
+ c_tzn="$c_tzn Time_zone_id int unsigned NOT NULL,"
+ c_tzn="$c_tzn PRIMARY KEY Name (Name)"
+ c_tzn="$c_tzn ) engine=MyISAM CHARACTER SET utf8"
+ c_tzn="$c_tzn comment='Time zone names';"
+
+ if test "$1" = "test"
+ then
+ i_tzn="$i_tzn INSERT INTO time_zone_name (Name, Time_Zone_id) VALUES"
+ i_tzn="$i_tzn ('MET', 1), ('UTC', 2), ('Universal', 2), "
+ i_tzn="$i_tzn ('Europe/Moscow',3), ('leap/Europe/Moscow',4), "
+ i_tzn="$i_tzn ('Japan', 5);"
+ fi
+fi
+
+if test ! -f $mdata/time_zone.frm
+then
+ if test "$1" = "verbose" ; then
+ echo "Preparing time_zone table" 1>&2;
+ fi
+
+ c_tz="$c_tz CREATE TABLE time_zone ("
+ c_tz="$c_tz Time_zone_id int unsigned NOT NULL auto_increment,"
+ c_tz="$c_tz Use_leap_seconds enum('Y','N') DEFAULT 'N' NOT NULL,"
+ c_tz="$c_tz PRIMARY KEY TzId (Time_zone_id)"
+ c_tz="$c_tz ) engine=MyISAM CHARACTER SET utf8"
+ c_tz="$c_tz comment='Time zones';"
+
+ if test "$1" = "test"
+ then
+ i_tz="$i_tz INSERT INTO time_zone (Time_zone_id, Use_leap_seconds)"
+ i_tz="$i_tz VALUES (1,'N'), (2,'N'), (3,'N'), (4,'Y'), (5,'N');"
+ fi
+fi
+
+if test ! -f $mdata/time_zone_transition.frm
+then
+ if test "$1" = "verbose" ; then
+ echo "Preparing time_zone_transition table" 1>&2;
+ fi
+
+ c_tzt="$c_tzt CREATE TABLE time_zone_transition ("
+ c_tzt="$c_tzt Time_zone_id int unsigned NOT NULL,"
+ c_tzt="$c_tzt Transition_time bigint signed NOT NULL,"
+ c_tzt="$c_tzt Transition_type_id int unsigned NOT NULL,"
+ c_tzt="$c_tzt PRIMARY KEY TzIdTranTime (Time_zone_id, Transition_time)"
+ c_tzt="$c_tzt ) engine=MyISAM CHARACTER SET utf8"
+ c_tzt="$c_tzt comment='Time zone transitions';"
+
+ if test "$1" = "test"
+ then
+ i_tzt="$i_tzt INSERT INTO time_zone_transition"
+ i_tzt="$i_tzt (Time_zone_id, Transition_time, Transition_type_id)"
+ i_tzt="$i_tzt VALUES"
+ i_tzt="$i_tzt (1, -1693706400, 0) ,(1, -1680483600, 1)"
+ i_tzt="$i_tzt ,(1, -1663455600, 2) ,(1, -1650150000, 3)"
+ i_tzt="$i_tzt ,(1, -1632006000, 2) ,(1, -1618700400, 3)"
+ i_tzt="$i_tzt ,(1, -938905200, 2) ,(1, -857257200, 3)"
+ i_tzt="$i_tzt ,(1, -844556400, 2) ,(1, -828226800, 3)"
+ i_tzt="$i_tzt ,(1, -812502000, 2) ,(1, -796777200, 3)"
+ i_tzt="$i_tzt ,(1, 228877200, 2) ,(1, 243997200, 3)"
+ i_tzt="$i_tzt ,(1, 260326800, 2) ,(1, 276051600, 3)"
+ i_tzt="$i_tzt ,(1, 291776400, 2) ,(1, 307501200, 3)"
+ i_tzt="$i_tzt ,(1, 323830800, 2) ,(1, 338950800, 3)"
+ i_tzt="$i_tzt ,(1, 354675600, 2) ,(1, 370400400, 3)"
+ i_tzt="$i_tzt ,(1, 386125200, 2) ,(1, 401850000, 3)"
+ i_tzt="$i_tzt ,(1, 417574800, 2) ,(1, 433299600, 3)"
+ i_tzt="$i_tzt ,(1, 449024400, 2) ,(1, 465354000, 3)"
+ i_tzt="$i_tzt ,(1, 481078800, 2) ,(1, 496803600, 3)"
+ i_tzt="$i_tzt ,(1, 512528400, 2) ,(1, 528253200, 3)"
+ i_tzt="$i_tzt ,(1, 543978000, 2) ,(1, 559702800, 3)"
+ i_tzt="$i_tzt ,(1, 575427600, 2) ,(1, 591152400, 3)"
+ i_tzt="$i_tzt ,(1, 606877200, 2) ,(1, 622602000, 3)"
+ i_tzt="$i_tzt ,(1, 638326800, 2) ,(1, 654656400, 3)"
+ i_tzt="$i_tzt ,(1, 670381200, 2) ,(1, 686106000, 3)"
+ i_tzt="$i_tzt ,(1, 701830800, 2) ,(1, 717555600, 3)"
+ i_tzt="$i_tzt ,(1, 733280400, 2) ,(1, 749005200, 3)"
+ i_tzt="$i_tzt ,(1, 764730000, 2) ,(1, 780454800, 3)"
+ i_tzt="$i_tzt ,(1, 796179600, 2) ,(1, 811904400, 3)"
+ i_tzt="$i_tzt ,(1, 828234000, 2) ,(1, 846378000, 3)"
+ i_tzt="$i_tzt ,(1, 859683600, 2) ,(1, 877827600, 3)"
+ i_tzt="$i_tzt ,(1, 891133200, 2) ,(1, 909277200, 3)"
+ i_tzt="$i_tzt ,(1, 922582800, 2) ,(1, 941331600, 3)"
+ i_tzt="$i_tzt ,(1, 954032400, 2) ,(1, 972781200, 3)"
+ i_tzt="$i_tzt ,(1, 985482000, 2) ,(1, 1004230800, 3)"
+ i_tzt="$i_tzt ,(1, 1017536400, 2) ,(1, 1035680400, 3)"
+ i_tzt="$i_tzt ,(1, 1048986000, 2) ,(1, 1067130000, 3)"
+ i_tzt="$i_tzt ,(1, 1080435600, 2) ,(1, 1099184400, 3)"
+ i_tzt="$i_tzt ,(1, 1111885200, 2) ,(1, 1130634000, 3)"
+ i_tzt="$i_tzt ,(1, 1143334800, 2) ,(1, 1162083600, 3)"
+ i_tzt="$i_tzt ,(1, 1174784400, 2) ,(1, 1193533200, 3)"
+ i_tzt="$i_tzt ,(1, 1206838800, 2) ,(1, 1224982800, 3)"
+ i_tzt="$i_tzt ,(1, 1238288400, 2) ,(1, 1256432400, 3)"
+ i_tzt="$i_tzt ,(1, 1269738000, 2) ,(1, 1288486800, 3)"
+ i_tzt="$i_tzt ,(1, 1301187600, 2) ,(1, 1319936400, 3)"
+ i_tzt="$i_tzt ,(1, 1332637200, 2) ,(1, 1351386000, 3)"
+ i_tzt="$i_tzt ,(1, 1364691600, 2) ,(1, 1382835600, 3)"
+ i_tzt="$i_tzt ,(1, 1396141200, 2) ,(1, 1414285200, 3)"
+ i_tzt="$i_tzt ,(1, 1427590800, 2) ,(1, 1445734800, 3)"
+ i_tzt="$i_tzt ,(1, 1459040400, 2) ,(1, 1477789200, 3)"
+ i_tzt="$i_tzt ,(1, 1490490000, 2) ,(1, 1509238800, 3)"
+ i_tzt="$i_tzt ,(1, 1521939600, 2) ,(1, 1540688400, 3)"
+ i_tzt="$i_tzt ,(1, 1553994000, 2) ,(1, 1572138000, 3)"
+ i_tzt="$i_tzt ,(1, 1585443600, 2) ,(1, 1603587600, 3)"
+ i_tzt="$i_tzt ,(1, 1616893200, 2) ,(1, 1635642000, 3)"
+ i_tzt="$i_tzt ,(1, 1648342800, 2) ,(1, 1667091600, 3)"
+ i_tzt="$i_tzt ,(1, 1679792400, 2) ,(1, 1698541200, 3)"
+ i_tzt="$i_tzt ,(1, 1711846800, 2) ,(1, 1729990800, 3)"
+ i_tzt="$i_tzt ,(1, 1743296400, 2) ,(1, 1761440400, 3)"
+ i_tzt="$i_tzt ,(1, 1774746000, 2) ,(1, 1792890000, 3)"
+ i_tzt="$i_tzt ,(1, 1806195600, 2) ,(1, 1824944400, 3)"
+ i_tzt="$i_tzt ,(1, 1837645200, 2) ,(1, 1856394000, 3)"
+ i_tzt="$i_tzt ,(1, 1869094800, 2) ,(1, 1887843600, 3)"
+ i_tzt="$i_tzt ,(1, 1901149200, 2) ,(1, 1919293200, 3)"
+ i_tzt="$i_tzt ,(1, 1932598800, 2) ,(1, 1950742800, 3)"
+ i_tzt="$i_tzt ,(1, 1964048400, 2) ,(1, 1982797200, 3)"
+ i_tzt="$i_tzt ,(1, 1995498000, 2) ,(1, 2014246800, 3)"
+ i_tzt="$i_tzt ,(1, 2026947600, 2) ,(1, 2045696400, 3)"
+ i_tzt="$i_tzt ,(1, 2058397200, 2) ,(1, 2077146000, 3)"
+ i_tzt="$i_tzt ,(1, 2090451600, 2) ,(1, 2108595600, 3)"
+ i_tzt="$i_tzt ,(1, 2121901200, 2) ,(1, 2140045200, 3)"
+ i_tzt="$i_tzt ,(3, -1688265000, 2) ,(3, -1656819048, 1)"
+ i_tzt="$i_tzt ,(3, -1641353448, 2) ,(3, -1627965048, 3)"
+ i_tzt="$i_tzt ,(3, -1618716648, 1) ,(3, -1596429048, 3)"
+ i_tzt="$i_tzt ,(3, -1593829848, 5) ,(3, -1589860800, 4)"
+ i_tzt="$i_tzt ,(3, -1542427200, 5) ,(3, -1539493200, 6)"
+ i_tzt="$i_tzt ,(3, -1525323600, 5) ,(3, -1522728000, 4)"
+ i_tzt="$i_tzt ,(3, -1491188400, 7) ,(3, -1247536800, 4)"
+ i_tzt="$i_tzt ,(3, 354920400, 5) ,(3, 370728000, 4)"
+ i_tzt="$i_tzt ,(3, 386456400, 5) ,(3, 402264000, 4)"
+ i_tzt="$i_tzt ,(3, 417992400, 5) ,(3, 433800000, 4)"
+ i_tzt="$i_tzt ,(3, 449614800, 5) ,(3, 465346800, 8)"
+ i_tzt="$i_tzt ,(3, 481071600, 9) ,(3, 496796400, 8)"
+ i_tzt="$i_tzt ,(3, 512521200, 9) ,(3, 528246000, 8)"
+ i_tzt="$i_tzt ,(3, 543970800, 9) ,(3, 559695600, 8)"
+ i_tzt="$i_tzt ,(3, 575420400, 9) ,(3, 591145200, 8)"
+ i_tzt="$i_tzt ,(3, 606870000, 9) ,(3, 622594800, 8)"
+ i_tzt="$i_tzt ,(3, 638319600, 9) ,(3, 654649200, 8)"
+ i_tzt="$i_tzt ,(3, 670374000, 10) ,(3, 686102400, 11)"
+ i_tzt="$i_tzt ,(3, 695779200, 8) ,(3, 701812800, 5)"
+ i_tzt="$i_tzt ,(3, 717534000, 4) ,(3, 733273200, 9)"
+ i_tzt="$i_tzt ,(3, 748998000, 8) ,(3, 764722800, 9)"
+ i_tzt="$i_tzt ,(3, 780447600, 8) ,(3, 796172400, 9)"
+ i_tzt="$i_tzt ,(3, 811897200, 8) ,(3, 828226800, 9)"
+ i_tzt="$i_tzt ,(3, 846370800, 8) ,(3, 859676400, 9)"
+ i_tzt="$i_tzt ,(3, 877820400, 8) ,(3, 891126000, 9)"
+ i_tzt="$i_tzt ,(3, 909270000, 8) ,(3, 922575600, 9)"
+ i_tzt="$i_tzt ,(3, 941324400, 8) ,(3, 954025200, 9)"
+ i_tzt="$i_tzt ,(3, 972774000, 8) ,(3, 985474800, 9)"
+ i_tzt="$i_tzt ,(3, 1004223600, 8) ,(3, 1017529200, 9)"
+ i_tzt="$i_tzt ,(3, 1035673200, 8) ,(3, 1048978800, 9)"
+ i_tzt="$i_tzt ,(3, 1067122800, 8) ,(3, 1080428400, 9)"
+ i_tzt="$i_tzt ,(3, 1099177200, 8) ,(3, 1111878000, 9)"
+ i_tzt="$i_tzt ,(3, 1130626800, 8) ,(3, 1143327600, 9)"
+ i_tzt="$i_tzt ,(3, 1162076400, 8) ,(3, 1174777200, 9)"
+ i_tzt="$i_tzt ,(3, 1193526000, 8) ,(3, 1206831600, 9)"
+ i_tzt="$i_tzt ,(3, 1224975600, 8) ,(3, 1238281200, 9)"
+ i_tzt="$i_tzt ,(3, 1256425200, 8) ,(3, 1269730800, 9)"
+ i_tzt="$i_tzt ,(3, 1288479600, 8) ,(3, 1301180400, 9)"
+ i_tzt="$i_tzt ,(3, 1319929200, 8) ,(3, 1332630000, 9)"
+ i_tzt="$i_tzt ,(3, 1351378800, 8) ,(3, 1364684400, 9)"
+ i_tzt="$i_tzt ,(3, 1382828400, 8) ,(3, 1396134000, 9)"
+ i_tzt="$i_tzt ,(3, 1414278000, 8) ,(3, 1427583600, 9)"
+ i_tzt="$i_tzt ,(3, 1445727600, 8) ,(3, 1459033200, 9)"
+ i_tzt="$i_tzt ,(3, 1477782000, 8) ,(3, 1490482800, 9)"
+ i_tzt="$i_tzt ,(3, 1509231600, 8) ,(3, 1521932400, 9)"
+ i_tzt="$i_tzt ,(3, 1540681200, 8) ,(3, 1553986800, 9)"
+ i_tzt="$i_tzt ,(3, 1572130800, 8) ,(3, 1585436400, 9)"
+ i_tzt="$i_tzt ,(3, 1603580400, 8) ,(3, 1616886000, 9)"
+ i_tzt="$i_tzt ,(3, 1635634800, 8) ,(3, 1648335600, 9)"
+ i_tzt="$i_tzt ,(3, 1667084400, 8) ,(3, 1679785200, 9)"
+ i_tzt="$i_tzt ,(3, 1698534000, 8) ,(3, 1711839600, 9)"
+ i_tzt="$i_tzt ,(3, 1729983600, 8) ,(3, 1743289200, 9)"
+ i_tzt="$i_tzt ,(3, 1761433200, 8) ,(3, 1774738800, 9)"
+ i_tzt="$i_tzt ,(3, 1792882800, 8) ,(3, 1806188400, 9)"
+ i_tzt="$i_tzt ,(3, 1824937200, 8) ,(3, 1837638000, 9)"
+ i_tzt="$i_tzt ,(3, 1856386800, 8) ,(3, 1869087600, 9)"
+ i_tzt="$i_tzt ,(3, 1887836400, 8) ,(3, 1901142000, 9)"
+ i_tzt="$i_tzt ,(3, 1919286000, 8) ,(3, 1932591600, 9)"
+ i_tzt="$i_tzt ,(3, 1950735600, 8) ,(3, 1964041200, 9)"
+ i_tzt="$i_tzt ,(3, 1982790000, 8) ,(3, 1995490800, 9)"
+ i_tzt="$i_tzt ,(3, 2014239600, 8) ,(3, 2026940400, 9)"
+ i_tzt="$i_tzt ,(3, 2045689200, 8) ,(3, 2058390000, 9)"
+ i_tzt="$i_tzt ,(3, 2077138800, 8) ,(3, 2090444400, 9)"
+ i_tzt="$i_tzt ,(3, 2108588400, 8) ,(3, 2121894000, 9)"
+ i_tzt="$i_tzt ,(3, 2140038000, 8)"
+ i_tzt="$i_tzt ,(4, -1688265000, 2) ,(4, -1656819048, 1)"
+ i_tzt="$i_tzt ,(4, -1641353448, 2) ,(4, -1627965048, 3)"
+ i_tzt="$i_tzt ,(4, -1618716648, 1) ,(4, -1596429048, 3)"
+ i_tzt="$i_tzt ,(4, -1593829848, 5) ,(4, -1589860800, 4)"
+ i_tzt="$i_tzt ,(4, -1542427200, 5) ,(4, -1539493200, 6)"
+ i_tzt="$i_tzt ,(4, -1525323600, 5) ,(4, -1522728000, 4)"
+ i_tzt="$i_tzt ,(4, -1491188400, 7) ,(4, -1247536800, 4)"
+ i_tzt="$i_tzt ,(4, 354920409, 5) ,(4, 370728010, 4)"
+ i_tzt="$i_tzt ,(4, 386456410, 5) ,(4, 402264011, 4)"
+ i_tzt="$i_tzt ,(4, 417992411, 5) ,(4, 433800012, 4)"
+ i_tzt="$i_tzt ,(4, 449614812, 5) ,(4, 465346812, 8)"
+ i_tzt="$i_tzt ,(4, 481071612, 9) ,(4, 496796413, 8)"
+ i_tzt="$i_tzt ,(4, 512521213, 9) ,(4, 528246013, 8)"
+ i_tzt="$i_tzt ,(4, 543970813, 9) ,(4, 559695613, 8)"
+ i_tzt="$i_tzt ,(4, 575420414, 9) ,(4, 591145214, 8)"
+ i_tzt="$i_tzt ,(4, 606870014, 9) ,(4, 622594814, 8)"
+ i_tzt="$i_tzt ,(4, 638319615, 9) ,(4, 654649215, 8)"
+ i_tzt="$i_tzt ,(4, 670374016, 10) ,(4, 686102416, 11)"
+ i_tzt="$i_tzt ,(4, 695779216, 8) ,(4, 701812816, 5)"
+ i_tzt="$i_tzt ,(4, 717534017, 4) ,(4, 733273217, 9)"
+ i_tzt="$i_tzt ,(4, 748998018, 8) ,(4, 764722818, 9)"
+ i_tzt="$i_tzt ,(4, 780447619, 8) ,(4, 796172419, 9)"
+ i_tzt="$i_tzt ,(4, 811897219, 8) ,(4, 828226820, 9)"
+ i_tzt="$i_tzt ,(4, 846370820, 8) ,(4, 859676420, 9)"
+ i_tzt="$i_tzt ,(4, 877820421, 8) ,(4, 891126021, 9)"
+ i_tzt="$i_tzt ,(4, 909270021, 8) ,(4, 922575622, 9)"
+ i_tzt="$i_tzt ,(4, 941324422, 8) ,(4, 954025222, 9)"
+ i_tzt="$i_tzt ,(4, 972774022, 8) ,(4, 985474822, 9)"
+ i_tzt="$i_tzt ,(4, 1004223622, 8) ,(4, 1017529222, 9)"
+ i_tzt="$i_tzt ,(4, 1035673222, 8) ,(4, 1048978822, 9)"
+ i_tzt="$i_tzt ,(4, 1067122822, 8) ,(4, 1080428422, 9)"
+ i_tzt="$i_tzt ,(4, 1099177222, 8) ,(4, 1111878022, 9)"
+ i_tzt="$i_tzt ,(4, 1130626822, 8) ,(4, 1143327622, 9)"
+ i_tzt="$i_tzt ,(4, 1162076422, 8) ,(4, 1174777222, 9)"
+ i_tzt="$i_tzt ,(4, 1193526022, 8) ,(4, 1206831622, 9)"
+ i_tzt="$i_tzt ,(4, 1224975622, 8) ,(4, 1238281222, 9)"
+ i_tzt="$i_tzt ,(4, 1256425222, 8) ,(4, 1269730822, 9)"
+ i_tzt="$i_tzt ,(4, 1288479622, 8) ,(4, 1301180422, 9)"
+ i_tzt="$i_tzt ,(4, 1319929222, 8) ,(4, 1332630022, 9)"
+ i_tzt="$i_tzt ,(4, 1351378822, 8) ,(4, 1364684422, 9)"
+ i_tzt="$i_tzt ,(4, 1382828422, 8) ,(4, 1396134022, 9)"
+ i_tzt="$i_tzt ,(4, 1414278022, 8) ,(4, 1427583622, 9)"
+ i_tzt="$i_tzt ,(4, 1445727622, 8) ,(4, 1459033222, 9)"
+ i_tzt="$i_tzt ,(4, 1477782022, 8) ,(4, 1490482822, 9)"
+ i_tzt="$i_tzt ,(4, 1509231622, 8) ,(4, 1521932422, 9)"
+ i_tzt="$i_tzt ,(4, 1540681222, 8) ,(4, 1553986822, 9)"
+ i_tzt="$i_tzt ,(4, 1572130822, 8) ,(4, 1585436422, 9)"
+ i_tzt="$i_tzt ,(4, 1603580422, 8) ,(4, 1616886022, 9)"
+ i_tzt="$i_tzt ,(4, 1635634822, 8) ,(4, 1648335622, 9)"
+ i_tzt="$i_tzt ,(4, 1667084422, 8) ,(4, 1679785222, 9)"
+ i_tzt="$i_tzt ,(4, 1698534022, 8) ,(4, 1711839622, 9)"
+ i_tzt="$i_tzt ,(4, 1729983622, 8) ,(4, 1743289222, 9)"
+ i_tzt="$i_tzt ,(4, 1761433222, 8) ,(4, 1774738822, 9)"
+ i_tzt="$i_tzt ,(4, 1792882822, 8) ,(4, 1806188422, 9)"
+ i_tzt="$i_tzt ,(4, 1824937222, 8) ,(4, 1837638022, 9)"
+ i_tzt="$i_tzt ,(4, 1856386822, 8) ,(4, 1869087622, 9)"
+ i_tzt="$i_tzt ,(4, 1887836422, 8) ,(4, 1901142022, 9)"
+ i_tzt="$i_tzt ,(4, 1919286022, 8) ,(4, 1932591622, 9)"
+ i_tzt="$i_tzt ,(4, 1950735622, 8) ,(4, 1964041222, 9)"
+ i_tzt="$i_tzt ,(4, 1982790022, 8) ,(4, 1995490822, 9)"
+ i_tzt="$i_tzt ,(4, 2014239622, 8) ,(4, 2026940422, 9)"
+ i_tzt="$i_tzt ,(4, 2045689222, 8) ,(4, 2058390022, 9)"
+ i_tzt="$i_tzt ,(4, 2077138822, 8) ,(4, 2090444422, 9)"
+ i_tzt="$i_tzt ,(4, 2108588422, 8) ,(4, 2121894022, 9)"
+ i_tzt="$i_tzt ,(4, 2140038022, 8)"
+ i_tzt="$i_tzt ,(5, -1009875600, 1);"
+ fi
+fi
+
+if test ! -f $mdata/time_zone_transition_type.frm
+then
+ if test "$1" = "verbose" ; then
+ echo "Preparing time_zone_transition_type table" 1>&2;
+ fi
+
+ c_tztt="$c_tztt CREATE TABLE time_zone_transition_type ("
+ c_tztt="$c_tztt Time_zone_id int unsigned NOT NULL,"
+ c_tztt="$c_tztt Transition_type_id int unsigned NOT NULL,"
+ c_tztt="$c_tztt Offset int signed DEFAULT 0 NOT NULL,"
+ c_tztt="$c_tztt Is_DST tinyint unsigned DEFAULT 0 NOT NULL,"
+ c_tztt="$c_tztt Abbreviation char(8) DEFAULT '' NOT NULL,"
+ c_tztt="$c_tztt PRIMARY KEY TzIdTrTId (Time_zone_id, Transition_type_id)"
+ c_tztt="$c_tztt ) engine=MyISAM CHARACTER SET utf8"
+ c_tztt="$c_tztt comment='Time zone transition types';"
+
+ if test "$1" = "test"
+ then
+ i_tztt="$i_tztt INSERT INTO time_zone_transition_type (Time_zone_id,"
+ i_tztt="$i_tztt Transition_type_id, Offset, Is_DST, Abbreviation) VALUES"
+ i_tztt="$i_tztt (1, 0, 7200, 1, 'MEST') ,(1, 1, 3600, 0, 'MET')"
+ i_tztt="$i_tztt ,(1, 2, 7200, 1, 'MEST') ,(1, 3, 3600, 0, 'MET')"
+ i_tztt="$i_tztt ,(2, 0, 0, 0, 'UTC')"
+ i_tztt="$i_tztt ,(3, 0, 9000, 0, 'MMT') ,(3, 1, 12648, 1, 'MST')"
+ i_tztt="$i_tztt ,(3, 2, 9048, 0, 'MMT') ,(3, 3, 16248, 1, 'MDST')"
+ i_tztt="$i_tztt ,(3, 4, 10800, 0, 'MSK') ,(3, 5, 14400, 1, 'MSD')"
+ i_tztt="$i_tztt ,(3, 6, 18000, 1, 'MSD') ,(3, 7, 7200, 0, 'EET')"
+ i_tztt="$i_tztt ,(3, 8, 10800, 0, 'MSK') ,(3, 9, 14400, 1, 'MSD')"
+ i_tztt="$i_tztt ,(3, 10, 10800, 1, 'EEST') ,(3, 11, 7200, 0, 'EET')"
+ i_tztt="$i_tztt ,(4, 0, 9000, 0, 'MMT') ,(4, 1, 12648, 1, 'MST')"
+ i_tztt="$i_tztt ,(4, 2, 9048, 0, 'MMT') ,(4, 3, 16248, 1, 'MDST')"
+ i_tztt="$i_tztt ,(4, 4, 10800, 0, 'MSK') ,(4, 5, 14400, 1, 'MSD')"
+ i_tztt="$i_tztt ,(4, 6, 18000, 1, 'MSD') ,(4, 7, 7200, 0, 'EET')"
+ i_tztt="$i_tztt ,(4, 8, 10800, 0, 'MSK') ,(4, 9, 14400, 1, 'MSD')"
+ i_tztt="$i_tztt ,(4, 10, 10800, 1, 'EEST') ,(4, 11, 7200, 0, 'EET')"
+ i_tztt="$i_tztt ,(5, 0, 32400, 0, 'CJT') ,(5, 1, 32400, 0, 'JST');"
+ fi
+fi
+
+if test ! -f $mdata/time_zone_leap_second.frm
+then
+ if test "$1" = "verbose" ; then
+ echo "Preparing time_zone_leap_second table" 1>&2;
+ fi
+
+ c_tzls="$c_tzls CREATE TABLE time_zone_leap_second ("
+ c_tzls="$c_tzls Transition_time bigint signed NOT NULL,"
+ c_tzls="$c_tzls Correction int signed NOT NULL,"
+ c_tzls="$c_tzls PRIMARY KEY TranTime (Transition_time)"
+ c_tzls="$c_tzls ) engine=MyISAM CHARACTER SET utf8"
+ c_tzls="$c_tzls comment='Leap seconds information for time zones';"
+
+ if test "$1" = "test"
+ then
+ i_tzls="$i_tzls INSERT INTO time_zone_leap_second "
+ i_tzls="$i_tzls (Transition_time, Correction) VALUES "
+ i_tzls="$i_tzls (78796800, 1) ,(94694401, 2) ,(126230402, 3)"
+ i_tzls="$i_tzls ,(157766403, 4) ,(189302404, 5) ,(220924805, 6)"
+ i_tzls="$i_tzls ,(252460806, 7) ,(283996807, 8) ,(315532808, 9)"
+ i_tzls="$i_tzls ,(362793609, 10) ,(394329610, 11) ,(425865611, 12)"
+ i_tzls="$i_tzls ,(489024012, 13) ,(567993613, 14) ,(631152014, 15)"
+ i_tzls="$i_tzls ,(662688015, 16) ,(709948816, 17) ,(741484817, 18)"
+ i_tzls="$i_tzls ,(773020818, 19) ,(820454419, 20) ,(867715220, 21)"
+ i_tzls="$i_tzls ,(915148821, 22);"
+ fi
+fi
+
+cat << END_OF_DATA
+use mysql;
+$c_d
+$i_d
+
+$c_h
+$i_h
+
+$c_u
+$i_u
+
+$c_f
+$i_f
+
+$c_t
+$c_c
+
+$c_ht
+$c_hc
+$c_hr
+$c_hk
+
+$c_tzn
+$i_tzn
+$c_tz
+$i_tz
+$c_tzt
+$i_tzt
+$c_tztt
+$i_tztt
+$c_tzls
+$i_tzls
+END_OF_DATA
+
diff --git a/scripts/mysql_find_rows.sh b/scripts/mysql_find_rows.sh
index 3d7bad3323e..91ffc326e16 100644
--- a/scripts/mysql_find_rows.sh
+++ b/scripts/mysql_find_rows.sh
@@ -16,7 +16,7 @@ usage() if ($opt_help || $opt_Information);
$query=$search=$database=$set=""; $eoq=0;
while (<>)
{
- next if (length($query) == 0 && /^\#/); # Skipp comments
+ next if (length($query) == 0 && /^\#/); # Skip comments
$query.=search($_);
if ($eoq)
{
diff --git a/scripts/mysql_fix_privilege_tables.sh b/scripts/mysql_fix_privilege_tables.sh
index 381cf599e32..b84e512b69a 100644
--- a/scripts/mysql_fix_privilege_tables.sh
+++ b/scripts/mysql_fix_privilege_tables.sh
@@ -1,292 +1,199 @@
#!/bin/sh
+# This script is a wrapper to pipe the mysql_fix_privilege_tables.sql
+# through the mysql client program to the mysqld server
-#
-# Copyright (C) 2004 MySQL AB
-# For a more info consult the file COPYRIGHT distributed with this file.
-#
-# This script converts any old privilege tables to privilege tables suitable
-# for MySQL 4.0.
-#
-# You can safely ignore all 'Duplicate column' and 'Unknown column' errors"
-# as this just means that your tables where already up to date.
-# This script is safe to run even if your tables are already up to date!
-#
-# On windows you should do 'mysql --force < mysql_fix_privilege_tables.sql'
-# instead of this script
-#
-# Usage:
-# mysql_fix_privilege_tables
-# - fix tables for host "localhost" as "root" with no password
-# mysql_fix_privilege_tables <password>
-# - fix tables for host "localhost" as "root" with <password>
-# mysql_fix_privilege_tables --sql-only
-# - output sql-script to file /usr/share/mysql/echo_stderr
-# mysql_fix_privilege_tables OPTIONS
-# - fix tables on connection with OPTIONS
-#
-# where OPTIONS are
-# --host=<host>
-# --port=<port>
-# --socket=<socket>
-# --user=<user>
-# --password=<password>
-# --database=<database>
-
-root_password=""
+# Default values (Can be changed in my.cnf)
+password=""
host="localhost"
user="root"
+sql_only=0
+basedir=""
+verbose=0
+args=""
port=""
socket=""
-comment=""
database="mysql"
-bindir="@bindir@"
+bindir=""
+
+file=mysql_fix_privilege_tables.sql
-# Old format where there is only one argument and it's the password
+# The following test is to make this script compatible with the 4.0 where
+# the single argument could be a password
if test "$#" = 1
then
case "$1" in
--*) ;;
- *) root_password="$1" ; shift ;;
+ *) old_style_password="$1" ; shift ;;
esac
fi
-# read all the options
-parse_arguments()
-{
+# The following code is almost identical to the code in mysql_install_db.sh
+
+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
- --sql-only) cmd="/usr/share/mysql/echo_stderr" ;;
+ --basedir=*) basedir=`echo "$arg" | sed -e 's/^[^=]*=//'` ;;
+ --user=*) user=`echo "$arg" | sed -e 's/^[^=]*=//'` ;;
+ --password=*) password=`echo "$arg" | sed -e 's/^[^=]*=//'` ;;
+ --host=*) host=`echo "$arg" | sed -e 's/^[^=]*=//'` ;;
+ --sql|--sql-only) sql_only=1 ;;
+ --verbose) verbose=1 ;;
--port=*) port=`echo "$arg" | sed -e "s;--port=;;"` ;;
- --user=*) user=`echo "$arg" | sed -e "s;--user=;;"` ;;
- --host=*) host=`echo "$arg" | sed -e "s;--host=;;"` ;;
--socket=*) socket=`echo "$arg" | sed -e "s;--socket=;;"` ;;
- --password=*) root_password=`echo "$arg" | sed -e "s;--password=;;"` ;;
--database=*) database=`echo "$arg" | sed -e "s;--database=;;"` ;;
--bindir=*) bindir=`echo "$arg" | sed -e "s;--bindir=;;"` ;;
*)
- echo "Unknown argument '$arg'"
- exit 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
}
-
-parse_arguments "$@"
-if test -z "$cmd"; then
- cmd="$bindir/mysql --no-defaults --force --user=$user --host=$host"
- if test ! -z "$root_password"; then
- cmd="$cmd --password=$root_password"
+# Get first arguments from the my.cfg file, groups [mysqld] and
+# [mysql_install_db], and then merge with the command line arguments
+
+for dir in ./bin @bindir@ @bindir@ extra $bindir/../bin $bindir/../extra
+do
+ if test -x $dir/my_print_defaults
+ then
+ print_defaults="$dir/my_print_defaults"
+ break
+ fi
+done
+
+parse_arguments `$print_defaults $defaults mysql_install_db mysql_fix_privilege_tables`
+parse_arguments PICK-ARGS-FROM-ARGV "$@"
+
+if test -z "$basedir"
+then
+ basedir=@prefix@
+ if test -z "$bindir"
+ then
+ bindir=@bindir@
fi
- if test ! -z "$port"; then
- cmd="$cmd --port=$port"
+ execdir=@libexecdir@
+ pkgdatadir=@pkgdatadir@
+else
+ if test -z "$bindir"
+ then
+ bindir="$basedir/bin"
fi
- if test ! -z "$socket"; then
- cmd="$cmd --socket=$socket"
+ if test -x "$basedir/libexec/mysqld"
+ then
+ execdir="$basedir/libexec"
+ elif test -x "@libexecdir@/mysqld"
+ then
+ execdir="@libexecdir@"
+ else
+ execdir="$basedir/bin"
fi
- cmd="$cmd $database"
fi
-echo "This scripts updates the mysql.user, mysql.db, mysql.host and the"
-echo "mysql.func tables to MySQL 3.22.14 and above."
-echo ""
-echo "This is needed if you want to use the new GRANT functions,"
-echo "CREATE AGGREGATE FUNCTION or want to use the more secure passwords in 3.23"
-echo ""
-echo "If you get 'Access denied' errors, you should run this script again"
-echo "and give the MySQL root user password as an argument!"
-
-echo "Converting all privilege tables to MyISAM format"
-$cmd <<END_OF_DATA
-ALTER TABLE user type=MyISAM;
-ALTER TABLE db type=MyISAM;
-ALTER TABLE host type=MyISAM;
-ALTER TABLE func type=MyISAM;
-ALTER TABLE columns_priv type=MyISAM;
-ALTER TABLE tables_priv type=MyISAM;
-END_OF_DATA
-
-
-# Fix old password format, add File_priv and func table
-echo ""
-echo "If your tables are already up to date or partially up to date you will"
-echo "get some warnings about 'Duplicated column name'. You can safely ignore these!"
-
-$cmd <<END_OF_DATA
-alter table user change password password char(16) NOT NULL;
-alter table user add File_priv enum('N','Y') NOT NULL;
-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') NOT NULL,
- PRIMARY KEY (name)
-);
-END_OF_DATA
-echo ""
-
-# Add the new grant colums
-
-echo "Creating Grant Alter and Index privileges if they don't exists"
-echo "You can ignore any Duplicate column errors"
-$cmd <<END_OF_DATA
-alter table user add Grant_priv enum('N','Y') NOT NULL,add References_priv enum('N','Y') NOT NULL,add Index_priv enum('N','Y') NOT NULL,add Alter_priv enum('N','Y') NOT NULL;
-alter table host add Grant_priv enum('N','Y') NOT NULL,add References_priv enum('N','Y') NOT NULL,add Index_priv enum('N','Y') NOT NULL,add Alter_priv enum('N','Y') NOT NULL;
-alter table db add Grant_priv enum('N','Y') NOT NULL,add References_priv enum('N','Y') NOT NULL,add Index_priv enum('N','Y') NOT NULL,add Alter_priv enum('N','Y') NOT NULL;
-END_OF_DATA
-res=$?
-echo ""
-
-# If the new grant columns didn't exists, copy File -> Grant
-# and Create -> Alter, Index, References
-
-if test $res = 0
+if test -z "$password"
then
- echo "Setting default privileges for the new grant, index and alter privileges"
- $cmd <<END_OF_DATA
- UPDATE user SET Grant_priv=File_priv,References_priv=Create_priv,Index_priv=Create_priv,Alter_priv=Create_priv;
- UPDATE db SET References_priv=Create_priv,Index_priv=Create_priv,Alter_priv=Create_priv;
- UPDATE host SET References_priv=Create_priv,Index_priv=Create_priv,Alter_priv=Create_priv;
-END_OF_DATA
- echo ""
+ password=$old_style_password
fi
-#
-# The second alter changes ssl_type to new 4.0.2 format
-
-echo "Adding columns needed by GRANT .. REQUIRE (openssl)"
-echo "You can ignore any Duplicate column errors"
-$cmd <<END_OF_DATA
-ALTER TABLE user
-ADD ssl_type enum('','ANY','X509', 'SPECIFIED') NOT NULL,
-ADD ssl_cipher BLOB NOT NULL,
-ADD x509_issuer BLOB NOT NULL,
-ADD x509_subject BLOB NOT NULL;
-ALTER TABLE user MODIFY ssl_type enum('','ANY','X509', 'SPECIFIED') NOT NULL;
-END_OF_DATA
-echo ""
-
-#
-# Create tables_priv and columns_priv if they don't exists
-#
-
-echo "Creating the new table and column privilege tables"
-
-$cmd <<END_OF_DATA
-CREATE TABLE IF NOT EXISTS tables_priv (
- Host char(60) DEFAULT '' NOT NULL,
- Db char(60) DEFAULT '' NOT NULL,
- User char(16) DEFAULT '' NOT NULL,
- Table_name char(60) 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') DEFAULT '' NOT NULL,
- Column_priv set('Select','Insert','Update','References') DEFAULT '' NOT NULL,
- PRIMARY KEY (Host,Db,User,Table_name)
-);
-CREATE TABLE IF NOT EXISTS columns_priv (
- Host char(60) DEFAULT '' NOT NULL,
- Db char(60) DEFAULT '' NOT NULL,
- User char(16) DEFAULT '' NOT NULL,
- Table_name char(60) DEFAULT '' NOT NULL,
- Column_name char(59) DEFAULT '' NOT NULL,
- Timestamp timestamp(14),
- Column_priv set('Select','Insert','Update','References') DEFAULT '' NOT NULL,
- PRIMARY KEY (Host,Db,User,Table_name,Column_name)
-);
-END_OF_DATA
-
-#
-# Name change of Type -> Column_priv from MySQL 3.22.12
-#
-
-echo "Changing name of columns_priv.Type -> columns_priv.Column_priv"
-echo "You can ignore any Unknown column errors from this"
-
-$cmd <<END_OF_DATA
-ALTER TABLE columns_priv change Type Column_priv set('Select','Insert','Update','References') DEFAULT '' NOT NULL;
-END_OF_DATA
-echo ""
-
-#
-# Add the new 'type' column to the func table.
-#
-
-echo "Fixing the func table"
-echo "You can ignore any Duplicate column errors"
-
-$cmd <<EOF
-alter table func add type enum ('function','aggregate') NOT NULL;
-EOF
-echo ""
-
-#
-# Change the user,db and host tables to MySQL 4.0 format
-#
+cmd="$bindir/mysql --no-defaults --force --user=$user --host=$host"
+if test ! -z "$password" ; then
+ cmd="$cmd --password=$password"
+fi
+if test ! -z "$port"; then
+ cmd="$cmd --port=$port"
+fi
+if test ! -z "$socket"; then
+ cmd="$cmd --socket=$socket"
+fi
+cmd="$cmd --database=$database"
-echo "Adding new fields used by MySQL 4.0.2 to the privilege tables"
-echo "You can ignore any Duplicate column errors"
+if test $sql_only = 1
+then
+ cmd="cat"
+fi
-$cmd <<END_OF_DATA
-alter table user
-add Show_db_priv enum('N','Y') DEFAULT 'N' NOT NULL AFTER alter_priv,
-add Super_priv enum('N','Y') DEFAULT 'N' NOT NULL AFTER Show_db_priv,
-add Create_tmp_table_priv enum('N','Y') DEFAULT 'N' NOT NULL AFTER Super_priv,
-add Lock_tables_priv enum('N','Y') DEFAULT 'N' NOT NULL AFTER Create_tmp_table_priv,
-add Execute_priv enum('N','Y') DEFAULT 'N' NOT NULL AFTER Lock_tables_priv,
-add Repl_slave_priv enum('N','Y') DEFAULT 'N' NOT NULL AFTER Execute_priv,
-add Repl_client_priv enum('N','Y') DEFAULT 'N' NOT NULL AFTER Repl_slave_priv;
-END_OF_DATA
+# Find where first mysql_fix_privilege_tables.sql is located
+for i in $basedir/support-files $basedir/share $basedir/share/mysql \
+ $basedir/scripts @pkgdatadir@ . ./scripts
+do
+ if test -f $i/$file
+ then
+ pkgdatadir=$i
+ break
+ fi
+done
-if test $? -eq "0"
+sql_file="$pkgdatadir/$file"
+if test ! -f $sql_file
then
- # Convert privileges so that users have similar privileges as before
- echo ""
- echo "Updating new privileges in MySQL 4.0.2 from old ones"
- $cmd <<END_OF_DATA
- update user set show_db_priv= select_priv, super_priv=process_priv, execute_priv=process_priv, create_tmp_table_priv='Y', Lock_tables_priv='Y', Repl_slave_priv=file_priv, Repl_client_priv=file_priv where user<>"";
-END_OF_DATA
- echo ""
+ echo "Could not find file '$file'."
+ echo "Please use --basedir to specify the directory where MySQL is installed"
+ exit 1
fi
-# Add fields that can be used to limit number of questions and connections
-# for some users.
-
-$cmd <<END_OF_DATA
-alter table user
-add max_questions int(11) NOT NULL AFTER x509_subject,
-add max_updates int(11) unsigned NOT NULL AFTER max_questions,
-add max_connections int(11) unsigned NOT NULL AFTER max_updates;
-END_OF_DATA
+s_echo()
+{
+ if test $sql_only = 0
+ then
+ echo $1
+ fi
+}
-#
-# Add Create_tmp_table_priv and Lock_tables_priv to db and host
-#
+s_echo "This script updates all the mysql privilege tables to be usable by"
+s_echo "MySQL 4.0 and above."
+s_echo ""
+s_echo "This is needed if you want to use the new GRANT functions,"
+s_echo "CREATE AGGREGATE FUNCTION, or the more secure passwords in 4.1"
+s_echo ""
-$cmd <<END_OF_DATA
-alter table db
-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 host
-add Create_tmp_table_priv enum('N','Y') DEFAULT 'N' NOT NULL,
-add Lock_tables_priv enum('N','Y') DEFAULT 'N' NOT NULL;
-END_OF_DATA
+if test $verbose = 1
+then
+ s_echo "You can safely ignore all 'Duplicate column' and 'Unknown column' errors"
+ s_echo "because these just mean that your tables are already up to date."
+ s_echo "This script is safe to run even if your tables are already up to date!"
+ s_echo ""
+fi
-#
-# Fix the new bugs discovered by new tests (for Bug #2874 Grant table bugs )
-#
-$cmd <<END_OF_DATA
-alter table db change Db Db char(64) binary DEFAULT '' NOT NULL;
-alter table host change Db Db char(64) binary DEFAULT '' NOT NULL;
-alter table user change password Password char(16) binary NOT NULL, change max_questions max_questions int(11) unsigned DEFAULT 0 NOT NULL;
-alter table tables_priv change Db Db char(64) binary DEFAULT '' NOT NULL, change Host Host char(60) binary DEFAULT '' NOT NULL, change User User char(16) binary DEFAULT '' NOT NULL, change Table_name Table_name char(64) binary DEFAULT '' NOT NULL;
-alter table tables_priv add KEY Grantor (Grantor);
-alter table columns_priv change Db Db char(64) binary DEFAULT '' NOT NULL, change Host Host char(60) binary DEFAULT '' NOT NULL, change User User char(16) binary DEFAULT '' NOT NULL, change Table_name Table_name char(64) binary DEFAULT '' NOT NULL, change Column_name Column_name char(64) binary DEFAULT '' NOT NULL;
-
-alter table db comment='Database privileges';
-alter table host comment='Host privileges; Merged with database privileges';
-alter table user comment='Users and global privileges';
-alter table func comment='User defined functions';
-alter table tables_priv comment='Table privileges';
-alter table columns_priv comment='Column privileges';
-END_OF_DATA
+if test $verbose = 0
+then
+ cat $sql_file | $cmd > /dev/null 2>&1
+else
+ cat $sql_file | $cmd > /dev/null
+fi
+if test $? = 0
+then
+ s_echo "done"
+else
+ s_echo "Got a failure from command:"
+ s_echo "$cmd"
+ s_echo "Please check the above output and try again."
+ if test $verbose = 0
+ then
+ s_echo ""
+ s_echo "Running the script with the --verbose option may give you some information"
+ s_echo "of what went wrong."
+ fi
+ s_echo ""
+ s_echo "If you get an 'Access denied' error, you should run this script again and"
+ s_echo "give the MySQL root user password as an argument with the --password= option"
+fi
diff --git a/scripts/mysql_fix_privilege_tables.sql b/scripts/mysql_fix_privilege_tables.sql
index 6e1fd0d1be5..a60d987f8b5 100644
--- a/scripts/mysql_fix_privilege_tables.sql
+++ b/scripts/mysql_fix_privilege_tables.sql
@@ -2,23 +2,20 @@
-- for MySQL 4.0.
-- You can safely ignore all 'Duplicate column' and 'Unknown column' errors"
--- as this just means that your tables where already up to date.
+-- because these just mean that your tables are already up to date.
-- This script is safe to run even if your tables are already up to date!
-- On unix, you should use the mysql_fix_privilege_tables script to execute
-- this sql script.
-- On windows you should do 'mysql --force mysql < mysql_fix_privilege_tables.sql'
-SET SQL_SAFE_UPDATES=0;
-
-USE mysql;
-ALTER TABLE user type=MyISAM;
-ALTER TABLE db type=MyISAM;
-ALTER TABLE host type=MyISAM;
-ALTER TABLE func type=MyISAM;
-ALTER TABLE columns_priv type=MyISAM;
-ALTER TABLE tables_priv type=MyISAM;
-ALTER TABLE user change Password Password char(41) not null;
+ALTER TABLE user type=MyISAM, CONVERT TO CHARACTER SET utf8 COLLATE utf8_bin;
+ALTER TABLE db type=MyISAM, CONVERT TO CHARACTER SET utf8 COLLATE utf8_bin;
+ALTER TABLE host type=MyISAM, CONVERT TO CHARACTER SET utf8 COLLATE utf8_bin;
+ALTER TABLE func type=MyISAM, CONVERT TO CHARACTER SET utf8 COLLATE utf8_bin;
+ALTER TABLE columns_priv type=MyISAM, CONVERT TO CHARACTER SET utf8 COLLATE utf8_bin;
+ALTER TABLE tables_priv type=MyISAM, CONVERT TO CHARACTER SET utf8 COLLATE utf8_bin;
+ALTER TABLE user change Password Password char(41) binary not null;
ALTER TABLE user add File_priv enum('N','Y') NOT NULL;
CREATE TABLE IF NOT EXISTS func (
name char(64) binary DEFAULT '' NOT NULL,
@@ -26,7 +23,7 @@ CREATE TABLE IF NOT EXISTS func (
dl char(128) DEFAULT '' NOT NULL,
type enum ('function','aggregate') NOT NULL,
PRIMARY KEY (name)
-);
+) CHARACTER SET utf8 COLLATE utf8_bin;
-- Detect whether or not we had the Grant_priv column
SET @hadGrantPriv:=0;
@@ -41,7 +38,6 @@ UPDATE user SET Grant_priv=File_priv,References_priv=Create_priv,Index_priv=Crea
UPDATE db SET References_priv=Create_priv,Index_priv=Create_priv,Alter_priv=Create_priv WHERE @hadGrantPriv = 0;
UPDATE host SET References_priv=Create_priv,Index_priv=Create_priv,Alter_priv=Create_priv WHERE @hadGrantPriv = 0;
-
--
-- The second alter changes ssl_type to new 4.0.2 format
-- Adding columns needed by GRANT .. REQUIRE (openssl)"
@@ -67,7 +63,7 @@ CREATE TABLE IF NOT EXISTS tables_priv (
Table_priv set('Select','Insert','Update','Delete','Create','Drop','Grant','References','Index','Alter') DEFAULT '' NOT NULL,
Column_priv set('Select','Insert','Update','References') DEFAULT '' NOT NULL,
PRIMARY KEY (Host,Db,User,Table_name)
-);
+) CHARACTER SET utf8 COLLATE utf8_bin;
CREATE TABLE IF NOT EXISTS columns_priv (
Host char(60) DEFAULT '' NOT NULL,
@@ -78,7 +74,7 @@ CREATE TABLE IF NOT EXISTS columns_priv (
Timestamp timestamp(14),
Column_priv set('Select','Insert','Update','References') DEFAULT '' NOT NULL,
PRIMARY KEY (Host,Db,User,Table_name,Column_name)
-);
+) CHARACTER SET utf8 COLLATE utf8_bin;
--
@@ -87,7 +83,6 @@ CREATE TABLE IF NOT EXISTS columns_priv (
ALTER TABLE columns_priv change Type Column_priv set('Select','Insert','Update','References') DEFAULT '' NOT NULL;
-
--
-- Add the new 'type' column to the func table.
--
@@ -111,7 +106,6 @@ ADD Execute_priv enum('N','Y') DEFAULT 'N' NOT NULL AFTER Lock_tables_priv,
ADD Repl_slave_priv enum('N','Y') DEFAULT 'N' NOT NULL AFTER Execute_priv,
ADD Repl_client_priv enum('N','Y') DEFAULT 'N' NOT NULL AFTER Repl_slave_priv;
-
-- Convert privileges so that users have similar privileges as before
UPDATE user SET Show_db_priv= Select_priv, Super_priv=Process_priv, Execute_priv=Process_priv, Create_tmp_table_priv='Y', Lock_tables_priv='Y', Repl_slave_priv=file_priv, Repl_client_priv=File_priv where user<>"" AND @hadShowDbPriv = 0;
@@ -139,7 +133,7 @@ ADD Lock_tables_priv enum('N','Y') DEFAULT 'N' NOT NULL;
alter table db change Db Db char(64) binary DEFAULT '' NOT NULL;
alter table host change Db Db char(64) binary DEFAULT '' NOT NULL;
-alter table user change password Password char(16) binary NOT NULL, change max_questions max_questions int(11) unsigned DEFAULT 0 NOT NULL;
+alter table user change max_questions max_questions int(11) unsigned DEFAULT 0 NOT NULL;
alter table tables_priv change Db Db char(64) binary DEFAULT '' NOT NULL, change Host Host char(60) binary DEFAULT '' NOT NULL, change User User char(16) binary DEFAULT '' NOT NULL, change Table_name Table_name char(64) binary DEFAULT '' NOT NULL;
alter table tables_priv add KEY Grantor (Grantor);
alter table columns_priv change Db Db char(64) binary DEFAULT '' NOT NULL, change Host Host char(60) binary DEFAULT '' NOT NULL, change User User char(16) binary DEFAULT '' NOT NULL, change Table_name Table_name char(64) binary DEFAULT '' NOT NULL, change Column_name Column_name char(64) binary DEFAULT '' NOT NULL;
@@ -150,3 +144,77 @@ alter table user comment='Users and global privileges';
alter table func comment='User defined functions';
alter table tables_priv comment='Table privileges';
alter table columns_priv comment='Column privileges';
+
+#
+# Create some possible missing tables
+#
+CREATE TABLE IF NOT EXISTS help_topic (
+help_topic_id int unsigned not null,
+name varchar(64) not null,
+help_category_id smallint unsigned not null,
+description text not null,
+example text not null,
+url varchar(128) not null,
+primary key (help_topic_id), unique index (name)
+) CHARACTER SET utf8 comment='help topics';
+
+CREATE TABLE IF NOT EXISTS help_category (
+help_category_id smallint unsigned not null,
+name varchar(64) not null,
+parent_category_id smallint unsigned null,
+url varchar(128) not null,
+primary key (help_category_id),
+unique index (name)
+) CHARACTER SET utf8 comment='help categories';
+
+CREATE TABLE IF NOT EXISTS help_relation (
+help_topic_id int unsigned not null references help_topic,
+help_keyword_id int unsigned not null references help_keyword,
+primary key (help_keyword_id, help_topic_id)
+) CHARACTER SET utf8 comment='keyword-topic relation';
+
+CREATE TABLE IF NOT EXISTS help_keyword (
+help_keyword_id int unsigned not null,
+name varchar(64) not null,
+primary key (help_keyword_id),
+unique index (name)
+) CHARACTER SET utf8 comment='help keywords';
+
+#
+# Create missing time zone related tables
+#
+
+CREATE TABLE IF NOT EXISTS time_zone_name (
+Name char(64) NOT NULL,
+Time_zone_id int unsigned NOT NULL,
+PRIMARY KEY Name (Name)
+) CHARACTER SET utf8 comment='Time zone names';
+
+CREATE TABLE IF NOT EXISTS time_zone (
+Time_zone_id int unsigned NOT NULL auto_increment,
+Use_leap_seconds enum('Y','N') DEFAULT 'N' NOT NULL,
+PRIMARY KEY TzId (Time_zone_id)
+) CHARACTER SET utf8 comment='Time zones';
+
+CREATE TABLE IF NOT EXISTS time_zone_transition (
+Time_zone_id int unsigned NOT NULL,
+Transition_time bigint signed NOT NULL,
+Transition_type_id int unsigned NOT NULL,
+PRIMARY KEY TzIdTranTime (Time_zone_id, Transition_time)
+) CHARACTER SET utf8 comment='Time zone transitions';
+
+CREATE TABLE IF NOT EXISTS time_zone_transition_type (
+Time_zone_id int unsigned NOT NULL,
+Transition_type_id int unsigned NOT NULL,
+Offset int signed DEFAULT 0 NOT NULL,
+Is_DST tinyint unsigned DEFAULT 0 NOT NULL,
+Abbreviation char(8) DEFAULT '' NOT NULL,
+PRIMARY KEY TzIdTrTId (Time_zone_id, Transition_type_id)
+) CHARACTER SET utf8 comment='Time zone transition types';
+
+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)
+) CHARACTER SET utf8 comment='Leap seconds information for time zones';
+
diff --git a/scripts/mysql_install_db.sh b/scripts/mysql_install_db.sh
index f9f3160d220..b4f59790e73 100644
--- a/scripts/mysql_install_db.sh
+++ b/scripts/mysql_install_db.sh
@@ -1,5 +1,5 @@
#!/bin/sh
-# Copyright (C) 2002-2004 MySQL AB
+# Copyright (C) 2002-2003 MySQL AB
# For a more info consult the file COPYRIGHT distributed with this file.
# This scripts creates the privilege tables db, host, user, tables_priv,
@@ -11,11 +11,8 @@ in_rpm=0
windows=0
defaults=""
user=""
-case "$1" in
- -IN-RPM)
- in_rpm="1"; shift
- ;;
-esac
+tmp_file=/tmp/mysql_install_db.$$
+
case "$1" in
--no-defaults|--defaults-file=*|--defaults-extra-file=*)
defaults="$1"; shift
@@ -83,6 +80,9 @@ execdir=
bindir=
basedir=
force=0
+verbose=0
+fill_help_tables=""
+
parse_arguments `$print_defaults $defaults mysqld mysql_install_db`
parse_arguments PICK-ARGS-FROM-ARGV "$@"
@@ -91,19 +91,36 @@ if test -z "$basedir"
then
basedir=@prefix@
bindir=@bindir@
- execdir=@libexecdir@
+ execdir=@libexecdir@
pkgdatadir=@pkgdatadir@
else
bindir="$basedir/bin"
-if test -x "$basedir/libexec/mysqld"
-then
- execdir="$basedir/libexec"
-elif test -x "@libexecdir@/mysqld"
+ if test -x "$basedir/libexec/mysqld"
+ then
+ execdir="$basedir/libexec"
+ elif test -x "@libexecdir@/mysqld"
+ then
+ execdir="@libexecdir@"
+ else
+ execdir="$basedir/bin"
+ fi
+fi
+
+# find fill_help_tables.sh
+for i in $basedir/support-files $basedir/share $basedir/share/mysql $basedir/scripts `pwd` `pwd`/scripts @pkgdatadir@
+do
+ if test -f $i/fill_help_tables.sql
+ then
+ pkgdatadir=$i
+ fi
+done
+
+if test -f $pkgdatadir/fill_help_tables.sql
then
- execdir="@libexecdir@"
+ fill_help_tables=$pkgdatadir/fill_help_tables.sql
else
- execdir="$basedir/bin"
-fi
+ echo "Could not find help file 'fill_help_tables.sql' in @pkgdatadir@ or inside $basedir".
+ exit 1;
fi
mdata=$ldata/mysql
@@ -143,7 +160,7 @@ then
resolved=`$bindir/resolveip localhost 2>&1`
if [ $? -ne 0 ]
then
- echo "Neither host '$hostname' nor 'localhost' could not be looked up with"
+ echo "Neither host '$hostname' nor 'localhost' could be looked up with"
echo "$bindir/resolveip"
echo "Please configure the 'hostname' command to return a correct hostname."
echo "If you want to solve this at a later stage, restart this script with"
@@ -166,6 +183,7 @@ then
fi
# Create database directories mysql & test
+
if test ! -d $ldata; then mkdir $ldata; chmod 700 $ldata ; fi
if test ! -d $ldata/mysql; then mkdir $ldata/mysql; chmod 700 $ldata/mysql ; fi
if test ! -d $ldata/test; then mkdir $ldata/test; chmod 700 $ldata/test ; fi
@@ -173,200 +191,59 @@ fi
chown $user $ldata $ldata/mysql $ldata/test;
fi
-# Initialize variables
-c_d="" i_d=""
-c_h="" i_h=""
-c_u="" i_u=""
-c_f="" i_f=""
-c_t="" c_c=""
-
-# Check for old tables
if test ! -f $mdata/db.frm
then
- echo "Preparing db table"
-
- # mysqld --bootstrap wants one command/line
- c_d="$c_d CREATE TABLE db ("
- c_d="$c_d Host char(60) binary DEFAULT '' NOT NULL,"
- c_d="$c_d Db char(64) binary DEFAULT '' NOT NULL,"
- c_d="$c_d User char(16) binary DEFAULT '' NOT NULL,"
- c_d="$c_d Select_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
- c_d="$c_d Insert_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
- c_d="$c_d Update_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
- c_d="$c_d Delete_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
- c_d="$c_d Create_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
- c_d="$c_d Drop_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
- c_d="$c_d Grant_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
- c_d="$c_d References_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
- c_d="$c_d Index_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
- c_d="$c_d Alter_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
- c_d="$c_d Create_tmp_table_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
- c_d="$c_d Lock_tables_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
- c_d="$c_d PRIMARY KEY Host (Host,Db,User),"
- c_d="$c_d KEY User (User)"
- c_d="$c_d )"
- c_d="$c_d comment='Database privileges';"
-
- i_d="INSERT INTO db VALUES ('%','test','','Y','Y','Y','Y','Y','Y','N','Y','Y','Y','Y','Y');
- INSERT INTO db VALUES ('%','test\_%','','Y','Y','Y','Y','Y','Y','N','Y','Y','Y','Y','Y');"
+ c_d="yes"
fi
-if test ! -f $mdata/host.frm
+if test $verbose = 1
then
- echo "Preparing host table"
-
- c_h="$c_h CREATE TABLE host ("
- c_h="$c_h Host char(60) binary DEFAULT '' NOT NULL,"
- c_h="$c_h Db char(64) binary DEFAULT '' NOT NULL,"
- c_h="$c_h Select_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
- c_h="$c_h Insert_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
- c_h="$c_h Update_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
- c_h="$c_h Delete_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
- c_h="$c_h Create_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
- c_h="$c_h Drop_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
- c_h="$c_h Grant_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
- c_h="$c_h References_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
- c_h="$c_h Index_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
- c_h="$c_h Alter_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
- c_h="$c_h Create_tmp_table_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
- c_h="$c_h Lock_tables_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
- c_h="$c_h PRIMARY KEY Host (Host,Db)"
- c_h="$c_h )"
- c_h="$c_h comment='Host privileges; Merged with database privileges';"
-fi
-
-if test ! -f $mdata/user.frm
-then
- echo "Preparing user table"
-
- c_u="$c_u CREATE TABLE user ("
- c_u="$c_u Host char(60) binary DEFAULT '' NOT NULL,"
- c_u="$c_u User char(16) binary DEFAULT '' NOT NULL,"
- c_u="$c_u Password char(16) binary DEFAULT '' NOT NULL,"
- c_u="$c_u Select_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
- c_u="$c_u Insert_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
- c_u="$c_u Update_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
- c_u="$c_u Delete_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
- c_u="$c_u Create_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
- c_u="$c_u Drop_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
- c_u="$c_u Reload_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
- c_u="$c_u Shutdown_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
- c_u="$c_u Process_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
- c_u="$c_u File_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
- c_u="$c_u Grant_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
- c_u="$c_u References_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
- c_u="$c_u Index_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
- c_u="$c_u Alter_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
- c_u="$c_u Show_db_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
- c_u="$c_u Super_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
- c_u="$c_u Create_tmp_table_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
- c_u="$c_u Lock_tables_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
- c_u="$c_u Execute_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
- c_u="$c_u Repl_slave_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
- c_u="$c_u Repl_client_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
- c_u="$c_u ssl_type enum('','ANY','X509', 'SPECIFIED') DEFAULT '' NOT NULL,"
- c_u="$c_u ssl_cipher BLOB NOT NULL,"
- c_u="$c_u x509_issuer BLOB NOT NULL,"
- c_u="$c_u x509_subject BLOB NOT NULL,"
- c_u="$c_u max_questions int(11) unsigned DEFAULT 0 NOT NULL,"
- c_u="$c_u max_updates int(11) unsigned DEFAULT 0 NOT NULL,"
- c_u="$c_u max_connections int(11) unsigned DEFAULT 0 NOT NULL,"
- c_u="$c_u PRIMARY KEY Host (Host,User)"
- c_u="$c_u )"
- c_u="$c_u comment='Users and global privileges';"
-
- i_u="INSERT INTO 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','','','','',0,0,0);
- INSERT INTO user VALUES ('$hostname','root','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0);
-
- REPLACE INTO 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','','','','',0,0,0);
- REPLACE INTO user VALUES ('$hostname','root','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0);
-
- INSERT INTO user (host,user) values ('localhost','');
- INSERT INTO user (host,user) values ('$hostname','');"
-fi
-
-if test ! -f $mdata/func.frm
-then
- echo "Preparing func table"
-
- c_f="$c_f CREATE TABLE func ("
- c_f="$c_f name char(64) binary DEFAULT '' NOT NULL,"
- c_f="$c_f ret tinyint(1) DEFAULT '0' NOT NULL,"
- c_f="$c_f dl char(128) DEFAULT '' NOT NULL,"
- c_f="$c_f type enum ('function','aggregate') NOT NULL,"
- c_f="$c_f PRIMARY KEY (name)"
- c_f="$c_f )"
- c_f="$c_f comment='User defined functions';"
-fi
-
-if test ! -f $mdata/tables_priv.frm
-then
- echo "Preparing tables_priv table"
-
- c_t="$c_t CREATE TABLE tables_priv ("
- c_t="$c_t Host char(60) binary DEFAULT '' NOT NULL,"
- c_t="$c_t Db char(64) binary DEFAULT '' NOT NULL,"
- c_t="$c_t User char(16) binary DEFAULT '' NOT NULL,"
- c_t="$c_t Table_name char(64) binary DEFAULT '' NOT NULL,"
- c_t="$c_t Grantor char(77) DEFAULT '' NOT NULL,"
- c_t="$c_t Timestamp timestamp(14),"
- c_t="$c_t Table_priv set('Select','Insert','Update','Delete','Create','Drop','Grant','References','Index','Alter') DEFAULT '' NOT NULL,"
- c_t="$c_t Column_priv set('Select','Insert','Update','References') DEFAULT '' NOT NULL,"
- c_t="$c_t PRIMARY KEY (Host,Db,User,Table_name),"
- c_t="$c_t KEY Grantor (Grantor)"
- c_t="$c_t )"
- c_t="$c_t comment='Table privileges';"
-fi
-
-if test ! -f $mdata/columns_priv.frm
-then
- echo "Preparing columns_priv table"
-
- c_c="$c_c CREATE TABLE columns_priv ("
- c_c="$c_c Host char(60) binary DEFAULT '' NOT NULL,"
- c_c="$c_c Db char(64) binary DEFAULT '' NOT NULL,"
- c_c="$c_c User char(16) binary DEFAULT '' NOT NULL,"
- c_c="$c_c Table_name char(64) binary DEFAULT '' NOT NULL,"
- c_c="$c_c Column_name char(64) binary DEFAULT '' NOT NULL,"
- c_c="$c_c Timestamp timestamp(14),"
- c_c="$c_c Column_priv set('Select','Insert','Update','References') DEFAULT '' NOT NULL,"
- c_c="$c_c PRIMARY KEY (Host,Db,User,Table_name,Column_name)"
- c_c="$c_c )"
- c_c="$c_c comment='Column privileges';"
+ create_option="verbose"
+else
+ create_option="real"
fi
if test -n "$user"; then
args="$args --user=$user"
fi
-echo "Installing all prepared tables"
-if eval "$mysqld $defaults $mysqld_opt --bootstrap --skip-grant-tables \
- --basedir=$basedir --datadir=$ldata --skip-innodb --skip-bdb \
- $args" << END_OF_DATA
-use mysql;
-$c_d
-$i_d
-
-$c_h
-$i_h
-
-$c_u
-$i_u
-
-$c_f
-$i_f
-
-$c_t
-$c_c
-END_OF_DATA
+if test "$in_rpm" -eq 0 -a "$windows" -eq 0
then
- echo ""
- if test "$in_rpm" = "0"
+ echo "Installing all prepared tables"
+fi
+mysqld_install_cmd_line="$mysqld $defaults $mysqld_opt --bootstrap \
+--skip-grant-tables --basedir=$basedir --datadir=$ldata --skip-innodb \
+--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
+ if test -n "$fill_help_tables"
then
+ if test "$in_rpm" -eq 0 -a "$windows" -eq 0
+ then
+ echo "Fill help tables"
+ fi
+ echo "use mysql;" > $tmp_file
+ cat $tmp_file $fill_help_tables | eval "$mysqld_install_cmd_line"
+ res=$?
+ rm $tmp_file
+ if test $res != 0
+ then
+ echo ""
+ echo "WARNING: HELP FILES ARE NOT COMPLETELY INSTALLED!"
+ echo "The \"HELP\" command might not work properly"
+ echo ""
+ fi
+ fi
+ if test "$in_rpm" = 0 -a "$windows" = 0
+ then
+ echo ""
echo "To start mysqld at boot time you have to copy support-files/mysql.server"
echo "to the right place for your system"
echo
fi
+ if test "$windows" -eq 0
+ then
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'"
@@ -396,14 +273,14 @@ then
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 https://order.mysql.com"
- echo
+ fi
exit 0
else
- echo "Installation of grant tables failed!"
+ echo "Installation of system tables failed!"
echo
echo "Examine the logs in $ldata for more information."
echo "You can also try to start the mysqld daemon with:"
- echo "$execdir/mysqld --skip-grant &"
+ echo "$mysqld --skip-grant &"
echo "You can use the command line tool"
echo "$bindir/mysql to connect to the mysql"
echo "database and look at the grant tables:"
diff --git a/scripts/mysql_prepare_privilege_tables_for_5.sql b/scripts/mysql_prepare_privilege_tables_for_5.sql
new file mode 100644
index 00000000000..a9b6d43aee0
--- /dev/null
+++ b/scripts/mysql_prepare_privilege_tables_for_5.sql
@@ -0,0 +1,53 @@
+
+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_zap.sh b/scripts/mysql_zap.sh
index f485d164282..89823c1373b 100644
--- a/scripts/mysql_zap.sh
+++ b/scripts/mysql_zap.sh
@@ -111,10 +111,10 @@ Usage: $0 [-signal] [-?Ift] [--help] pattern
Options: -I or -? "info" -f "force" -t "test".
Version 1.0
-Kill processes with matches pattern.
+Kill processes that match the pattern.
If -f isn't given, ask user for confirmation for each process to kill.
-If signal isn't given, try first with signal 15 and after that with signal 9.
-If -t is given the processes is only shown on stdout.
+If signal isn't given, try first with signal 15, then with signal 9.
+If -t is given, the processes are only shown on stdout.
EOF
exit(1);
}
diff --git a/scripts/mysqlaccess.sh b/scripts/mysqlaccess.sh
index 75ef63ecdd0..9fd1f63f67a 100644
--- a/scripts/mysqlaccess.sh
+++ b/scripts/mysqlaccess.sh
@@ -414,7 +414,6 @@ _HOWTO
use Getopt::Long;
use Sys::Hostname;
use IPC::Open3;
-#use CGI; #moved to use of CGI by monty
# ****************************
@@ -527,7 +526,7 @@ if ($MySQLaccess::CMD) { #command-line version
}
}
if ($MySQLaccess::CGI) { #CGI-version
- use CGI;
+ require CGI;
$Q = new CGI;
$Param{'help'} = $Q->param('help') ;
$Param{'host'} = $Q->param('host') || $Q->param('h') || $Param{'host'};
diff --git a/scripts/mysqld_multi.sh b/scripts/mysqld_multi.sh
index b75aa1a7c31..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,17 +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();
+ if (!defined(($mysqladmin= my_which($opt_mysqladmin))) && $opt_verbose)
+ {
+ 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();
+ }
}
}
@@ -170,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
@@ -185,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)
@@ -195,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;
@@ -250,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)
{
@@ -269,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
{
@@ -283,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)
@@ -301,7 +329,7 @@ sub start_mysqlds()
sub stop_mysqlds()
{
- my (@groups, $com, $i, @options, $j);
+ my (@groups, $com, $i, @options);
if (!$opt_no_log)
{
@@ -314,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.= " &";
@@ -344,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.
@@ -517,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
@@ -585,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
@@ -601,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);
}
@@ -631,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
@@ -672,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/mysqlhotcopy.sh b/scripts/mysqlhotcopy.sh
index f9e29e33195..2cfe91da115 100644
--- a/scripts/mysqlhotcopy.sh
+++ b/scripts/mysqlhotcopy.sh
@@ -635,6 +635,7 @@ sub copy_index
my $to="$target/$file";
my $buff;
open(INPUT, "<$from") || die "Can't open file $from: $!\n";
+ binmode(INPUT, ":raw");
my $length=read INPUT, $buff, 2048;
die "Can't read index header from $from\n" if ($length < 1024);
close INPUT;