1525
1525
if (!$opt_extern)
1527
1527
# Look for SQL scripts directory
1528
if ( mtr_file_exists("$path_share/mysql_system_tables.sql") ne "")
1530
# The SQL scripts are in path_share
1531
$path_sql_dir= $path_share;
1535
$path_sql_dir= mtr_path_exists("$glob_basedir/share",
1536
"$glob_basedir/scripts");
1539
1528
if ( $mysql_version_id >= 50100 )
1541
1530
$exe_mysqlslap= mtr_exe_exists("$path_client_bindir/mysqlslap");
2931
2920
# export MYSQLD_BOOTSTRAP_CMD variable containing <path>/mysqld <args>
2932
2921
# ----------------------------------------------------------------------
2933
2922
$ENV{'MYSQLD_BOOTSTRAP_CMD'}= "$exe_mysqld_bootstrap " . join(" ", @$args);
2935
# ----------------------------------------------------------------------
2936
# Create the bootstrap.sql file
2937
# ----------------------------------------------------------------------
2938
my $bootstrap_sql_file= "$opt_vardir/tmp/bootstrap.sql";
2940
# Use the mysql database for system tables
2941
mtr_tofile($bootstrap_sql_file, "use mysql");
2943
# Add the offical mysql system tables
2944
# for a production system
2945
mtr_appendfile_to_file("$path_sql_dir/mysql_system_tables.sql",
2946
$bootstrap_sql_file);
2949
# Add test data for timezone - this is just a subset, on a real
2950
# system these tables will be populated either by mysql_tzinfo_to_sql
2951
# or by downloading the timezone table package from our website
2952
mtr_appendfile_to_file("$path_sql_dir/mysql_test_data_timezone.sql",
2953
$bootstrap_sql_file);
2955
# Remove anonymous users
2956
mtr_tofile($bootstrap_sql_file,
2957
"DELETE FROM mysql.user where user= '';");
2959
# Log bootstrap command
2960
my $path_bootstrap_log= "$opt_vardir/log/bootstrap.log";
2961
mtr_tofile($path_bootstrap_log,
2962
"$exe_mysqld_bootstrap " . join(" ", @$args) . "\n");
2965
if ( mtr_run($exe_mysqld_bootstrap, $args, $bootstrap_sql_file,
2966
$path_bootstrap_log, $path_bootstrap_log,
2967
"", { append_log_file => 1 }) != 0 )
2970
mtr_error("Error executing mysqld --bootstrap\n" .
2971
"Could not install system database from $bootstrap_sql_file\n" .
2972
"see $path_bootstrap_log for errors");