1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-27 13:04:36 +03:00

WL #3670: Compile-time option to remove GRANT-related startup options

- configure --disable-grant-options defines DISABLE_GRANT_OPTIONS
- configure.js/cmake also updated
- if DISABLE_GRANT_OPTIONS is defined, mysqld no longer recognizes:
  --bootstrap
  --init-file
  --skip-grant-tables

Scripts which rely on those three options are modified to check the environment for MYSQLD_BOOTSTRAP; it should be set to the full path of a mysqld which does handle those options.

For example:

$ export MYSQLD_BOOTSTRAP
$ MYSQLD_BOOTSTRAP=/path/to/full/MySQL/bin/mysqld
$ mysql_install_db
$ make test
This commit is contained in:
tsmith@siva.hindu.god
2007-01-09 19:22:01 -07:00
parent dbf5fe90a6
commit bac65ee90a
9 changed files with 59 additions and 7 deletions

View File

@@ -55,14 +55,17 @@ fi
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
@@ -88,8 +91,11 @@ 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 --skip-bdb \
mysqld_boot="${MYSQLD_BOOTSTRAP-$mysqld}"
mysqld_boot="$mysqld_boot --no-defaults --bootstrap --skip-grant-tables \
--basedir=$basedir --datadir=$ldata \
--skip-innodb --skip-ndbcluster --skip-bdb \
$EXTRA_ARG"
echo "running $mysqld_boot"

View File

@@ -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 )

View File

@@ -292,6 +292,14 @@ void install_db(char *datadir)
die("Unable to create init_db.sql.");
/* args */
init_args(&al);
/*
XXX: If mysqld is compiled with DISABLE_GRANT_OPTIONS defined, it
will not recognize the --bootstrap, --init-file or --skip-grant-
tables options. If this is needed here, please check
MYSQLD_BOOTSTRAP in the environment, and use its value instead of
mysqld_file if it is set. See mysql-test-run.pl and
mysql_install_db.
*/
add_arg(&al, mysqld_file);
add_arg(&al, "--no-defaults");
add_arg(&al, "--bootstrap");