diff options
-rw-r--r-- | configure.in | 17 | ||||
-rw-r--r-- | mysql-test/install_test_db.sh | 11 | ||||
-rwxr-xr-x | mysql-test/mysql-test-run.pl | 11 | ||||
-rw-r--r-- | scripts/mysql_install_db.sh | 3 | ||||
-rw-r--r-- | sql/mysqld.cc | 6 |
5 files changed, 41 insertions, 7 deletions
diff --git a/configure.in b/configure.in index 60c41689057..2a238a1f221 100644 --- a/configure.in +++ b/configure.in @@ -678,7 +678,22 @@ else AC_MSG_RESULT([no]) fi - +# If we should allow init-file, skip-grant-table and bootstrap options +AC_MSG_CHECKING(If we should should enable init-file, skip-grant-table options and bootstrap) +AC_ARG_ENABLE(grant-options, + [ --disable-grant-options Disables the use of --init-file, --skip-grant-tables and --bootstrap options], + [ mysql_grant_options_enabled=$enableval ], + [ mysql_grant_options_enabled=yes ] + ) +if test "$mysql_grant_options_enabled" = "yes" +then + AC_MSG_RESULT([yes]) +else + AC_DEFINE([DISABLE_GRANT_OPTIONS], [1], + [Disables the use of --init-file, --skip-grant-tables and --bootstrap options]) + AC_MSG_RESULT([no]) +fi + MYSQL_SYS_LARGEFILE # Types that must be checked AFTER large file support is checked diff --git a/mysql-test/install_test_db.sh b/mysql-test/install_test_db.sh index 4ca3e32a9a0..74d95fdc521 100644 --- a/mysql-test/install_test_db.sh +++ b/mysql-test/install_test_db.sh @@ -66,14 +66,17 @@ ldata=$fix_bin/$data mdata=$data/mysql EXTRA_ARG="" -if test ! -x $execdir/mysqld +mysqld= +if test -x $execdir/mysqld then + mysqld=$execdir/mysqld +else if test ! -x $libexecdir/mysqld then echo "mysqld is missing - looked in $execdir and in $libexecdir" exit 1 else - execdir=$libexecdir + mysqld=$libexecdir/mysqld fi fi @@ -99,7 +102,9 @@ basedir=. EXTRA_ARG="--language=../sql/share/english/ --character-sets-dir=../sql/share/charsets/" fi -mysqld_boot=" $execdir/mysqld --no-defaults --bootstrap --skip-grant-tables --basedir=$basedir --datadir=$ldata --skip-innodb --skip-ndbcluster --tmpdir=. $EXTRA_ARG" +mysqld_boot="${MYSQLD_BOOTSTRAP-$mysqld}" + +mysqld_boot="$mysqld_boot --no-defaults --bootstrap --skip-grant-tables --basedir=$basedir --datadir=$ldata --skip-innodb --skip-ndbcluster --tmpdir=. $EXTRA_ARG" echo "running $mysqld_boot" if $scriptdir/mysql_create_system_tables test $mdata $hostname | $mysqld_boot diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl index ccee36025ee..b26c1eb6ca0 100755 --- a/mysql-test/mysql-test-run.pl +++ b/mysql-test/mysql-test-run.pl @@ -2873,12 +2873,19 @@ sub install_db ($$) { mtr_add_arg($args, "--character-sets-dir=%s", $path_charsetsdir); } + # If DISABLE_GRANT_OPTIONS is defined when the server is compiled (e.g., + # configure --disable-grant-options), mysqld will not recognize the + # --bootstrap or --skip-grant-tables options. The user can set + # MYSQLD_BOOTSTRAP to the full path to a mysqld which does accept + # --bootstrap, to accommodate this. + my $exe_mysqld_bootstrap = $ENV{'MYSQLD_BOOTSTRAP'} || $exe_mysqld; + # Log bootstrap command my $path_bootstrap_log= "$opt_vardir/log/bootstrap.log"; mtr_tofile($path_bootstrap_log, - "$exe_mysqld " . join(" ", @$args) . "\n"); + "$exe_mysqld_bootstrap " . join(" ", @$args) . "\n"); - if ( mtr_run($exe_mysqld, $args, $init_db_sql_tmp, + if ( mtr_run($exe_mysqld_bootstrap, $args, $init_db_sql_tmp, $path_bootstrap_log, $path_bootstrap_log, "", { append_log_file => 1 }) != 0 ) diff --git a/scripts/mysql_install_db.sh b/scripts/mysql_install_db.sh index a4b187e3243..59645d090c4 100644 --- a/scripts/mysql_install_db.sh +++ b/scripts/mysql_install_db.sh @@ -236,7 +236,8 @@ if test "$in_rpm" -eq 0 -a "$windows" -eq 0 then echo "Installing all prepared tables" fi -mysqld_install_cmd_line="$mysqld $defaults $mysqld_opt --bootstrap \ +mysqld_bootstrap="${MYSQLD_BOOTSTRAP-$mysqld}" +mysqld_install_cmd_line="$mysqld_bootstrap $defaults $mysqld_opt --bootstrap \ --skip-grant-tables --basedir=$basedir --datadir=$ldata --skip-innodb \ --skip-ndbcluster $args --max_allowed_packet=8M --net_buffer_length=16K" if $scriptdir/mysql_create_system_tables $create_option $mdata $hostname $windows \ diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 11a57af5cb1..590d3d59a00 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -4970,8 +4970,10 @@ struct my_option my_long_options[] = /* app_type */ 0 }, #endif +#ifndef DISABLE_GRANT_OPTIONS {"bootstrap", OPT_BOOTSTRAP, "Used by mysql installation scripts.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, +#endif {"character-set-client-handshake", OPT_CHARACTER_SET_CLIENT_HANDSHAKE, "Don't ignore client side character set value sent during handshake.", (gptr*) &opt_character_set_client_handshake, @@ -5094,9 +5096,11 @@ Disable with --skip-large-pages.", {"init-connect", OPT_INIT_CONNECT, "Command(s) that are executed for each new connection", (gptr*) &opt_init_connect, (gptr*) &opt_init_connect, 0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, +#ifndef DISABLE_GRANT_OPTIONS {"init-file", OPT_INIT_FILE, "Read SQL commands from this file at startup.", (gptr*) &opt_init_file, (gptr*) &opt_init_file, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, +#endif {"init-rpl-role", OPT_INIT_RPL_ROLE, "Set the replication role.", 0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"init-slave", OPT_INIT_SLAVE, "Command(s) that are executed when a slave connects to this master", @@ -5601,10 +5605,12 @@ Can't be set to 1 if --log-slave-updates is used.", "Show user and password in SHOW SLAVE HOSTS on this master", (gptr*) &opt_show_slave_auth_info, (gptr*) &opt_show_slave_auth_info, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, +#ifndef DISABLE_GRANT_OPTIONS {"skip-grant-tables", OPT_SKIP_GRANT, "Start without grant tables. This gives all users FULL ACCESS to all tables!", (gptr*) &opt_noacl, (gptr*) &opt_noacl, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, +#endif {"skip-host-cache", OPT_SKIP_HOST_CACHE, "Don't cache host names.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, {"skip-locking", OPT_SKIP_LOCK, |