1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320
|
--source include/big_test.inc
let BASEDIR= `select @@basedir`;
let DDIR=$MYSQL_TMP_DIR/installdb_test;
let MYSQLD_LOG=$MYSQL_TMP_DIR/server.log;
let extra_args=--no-defaults --innodb_dedicated_server=OFF --console --loose-skip-auto_generate_certs --loose-skip-sha256_password_auto_generate_rsa_keys --skip-ssl --basedir=$BASEDIR --lc-messages-dir=$MYSQL_SHAREDIR;
let BOOTSTRAP_SQL=$MYSQL_TMP_DIR/tiny_bootstrap.sql;
let PASSWD_FILE=$MYSQL_TMP_DIR/password_file.txt;
--echo # Save the count of columns in mysql
--let $mysql_cnt=`SELECT COUNT(COLUMN_NAME) FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_SCHEMA='mysql'`
--echo # shut server down
--exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--shutdown_server
--source include/wait_until_disconnected.inc
--echo # Server is down
--echo #
--echo # Try --initialize
--echo #
--echo # Run the server with --initialize
--exec $MYSQLD $extra_args --initialize --datadir=$DDIR --log-error-verbosity=1 > $MYSQLD_LOG 2>&1
--echo extract the root password
--perl
use strict;
my $log= $ENV{'MYSQLD_LOG'} or die;
my $passwd_file= $ENV{'PASSWD_FILE'} or die;
my $FILE;
open(FILE, "$log") or die;
while (my $row = <FILE>)
{
if ($row =~ m/.*A temporary password is generated for root.localhost: ([^ \n][^ \n]*)/)
{
my $passwd=$1;
print "password found\n";
my $OUT_FILE;
open(OUT_FILE, "> $passwd_file");
print OUT_FILE "delimiter lessprobability;\n";
print OUT_FILE "let new_pwd=$passwd";
print OUT_FILE "lessprobability\n";
print OUT_FILE "--delimiter ;\n";
close(OUT_FILE);
}
}
close(FILE);
EOF
source $passwd_file;
--echo # Restart the server against DDIR
--exec echo "restart:--datadir=$DDIR " > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--enable_reconnect
--source include/wait_until_connected_again.inc
--echo # connect as root
connect(root_con,localhost,root,$new_pwd,mysql);
--echo # must fail due to password expiration
--error ER_MUST_CHANGE_PASSWORD
SELECT 1;
--echo # reset the password
SET PASSWORD='';
--echo # Check the count of columns in mysql
--let $cnt=`SELECT COUNT(COLUMN_NAME) FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_SCHEMA='mysql';`
if ($cnt != $mysql_cnt)
{
--echo # Column count doesn't match. mtr=$mysql_cnt server=$cnt
--echo list columns in I_S.COLUMNS for the mysql db
SELECT TABLE_NAME,COLUMN_NAME FROM INFORMATION_SCHEMA.COLUMNS
WHERE TABLE_SCHEMA='mysql' ORDER BY TABLE_NAME,ORDINAL_POSITION;
}
--echo # check the user account
SELECT user, host, plugin, LENGTH(authentication_string)
FROM mysql.user ORDER by user;
--echo # Check the sys schema exists with the right object counts
--echo #
--echo # If this value differs, also update SYS_PROCEDURE_COUNT within ./client/upgrade/program.cc
SELECT COUNT(*) FROM INFORMATION_SCHEMA.ROUTINES WHERE ROUTINE_SCHEMA = 'sys' AND ROUTINE_TYPE = 'PROCEDURE';
--echo # If this value differs, also update SYS_FUNCTION_COUNT within ./client/upgrade/program.cc
SELECT COUNT(*) FROM INFORMATION_SCHEMA.ROUTINES WHERE ROUTINE_SCHEMA = 'sys' AND ROUTINE_TYPE = 'FUNCTION';
--echo # If this value differs, also update SYS_TABLE_COUNT within ./client/upgrade/program.cc
SELECT COUNT(*) FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = 'sys' AND TABLE_TYPE = 'BASE TABLE';
--echo # If this value differs, also update SYS_VIEW_COUNT within ./client/upgrade/program.cc
SELECT COUNT(*) FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = 'sys' AND TABLE_TYPE = 'VIEW';
--echo # If this value differs, also update SYS_TRIGGER_COUNT within ./client/upgrade/program.cc
SELECT COUNT(*) FROM INFORMATION_SCHEMA.TRIGGERS WHERE TRIGGER_SCHEMA = 'sys';
CREATE DATABASE test;
--echo # shut server down
--exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--shutdown_server
--source include/wait_until_disconnected.inc
--echo # Server is down
--echo # close the test connection
connection default;
disconnect root_con;
--echo # remove the password file
remove_file $PASSWD_FILE;
--echo # delete mysqld log
remove_file $MYSQLD_LOG;
--echo # delete datadir
--force-rmdir $DDIR
--echo #
--echo # Try --initialize-insecure --init-file
--echo #
--echo # create bootstrap file
write_file $BOOTSTRAP_SQL;
CREATE DATABASE test;
CREATE TABLE mysql.t1(a INT) ENGINE=innodb;
INSERT INTO mysql.t1 VALUES (1);
INSERT INTO mysql.t1 VALUES (2);
EOF
--echo # Run the server with --initialize-insecure --init-file
--exec $MYSQLD $extra_args --initialize-insecure --datadir=$DDIR --init-file=$BOOTSTRAP_SQL > $MYSQLD_LOG 2>&1
--echo # Restart the server against DDIR
--exec echo "restart:--datadir=$DDIR " > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--enable_reconnect
--source include/wait_until_connected_again.inc
--echo # connect as root
connect(root_con,localhost,root,,mysql);
--echo # must pass: no password expiration
SELECT 1;
--echo # Check the count of columns in mysql
--let $cnt=`SELECT COUNT(COLUMN_NAME) FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_SCHEMA='mysql';`
--echo # Take out the extra t1 column
--dec $cnt
if ($cnt != $mysql_cnt)
{
--echo # Column count doesn't match. mtr=$mysql_cnt server=$cnt
--echo list columns in I_S.COLUMNS for the mysql db
SELECT TABLE_NAME,COLUMN_NAME FROM INFORMATION_SCHEMA.COLUMNS
WHERE TABLE_SCHEMA='mysql' ORDER BY TABLE_NAME,ORDINAL_POSITION;
}
--echo # check the user account
SELECT user, host, plugin, LENGTH(authentication_string)
FROM mysql.user ORDER BY user;
--echo # check the result of running --init-file
SELECT a FROM t1 ORDER BY a;
--echo # shut server down
--exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--shutdown_server
--source include/wait_until_disconnected.inc
--echo # Server is down
--echo # close the test connection
connection default;
disconnect root_con;
--echo # delete mysqld log
remove_file $MYSQLD_LOG;
--echo # delete bootstrap file
remove_file $BOOTSTRAP_SQL;
--echo # delete datadir
--force-rmdir $DDIR
--echo #
--echo # Try --initialize-insecure --init-file=empty_file for error handling
--echo #
--echo # Run the server with --initialize-insecure --init-file=empty
--error 1
--exec $MYSQLD $extra_args --initialize-insecure --datadir=$DDIR --init-file=$NO_SUCH_BOOTSTRAP_SQL > $MYSQLD_LOG 2>&1
--echo # delete mysqld log
remove_file $MYSQLD_LOG;
--echo # delete datadir
--force-rmdir $DDIR
--echo #
--echo # Try --initialize-insecure --init-file=relative_path for error handling
--echo #
--echo # Run the server with --initialize-insecure --init-file=haha.sql
--error 1
--exec $MYSQLD $extra_args --initialize-insecure --datadir=$DDIR --init-file=haha.sql > $MYSQLD_LOG 2>&1
--echo # delete mysqld log
remove_file $MYSQLD_LOG;
--echo # delete datadir
--force-rmdir $DDIR
--echo #
--echo # Bug#22777039 - MYSQLD --INITIALIZE DOES NOT SUPPORT THE KEYRING_FILE_DATA OPTION
--echo #
--exec $MYSQLD $extra_args --datadir=$DDIR --initialize --early-plugin-load="keyring_file=$KEYRING_PLUGIN" --keyring_file_data=$MYSQL_TMP_DIR/keyring $KEYRING_PLUGIN_OPT > $MYSQLD_LOG 2>&1
--echo # delete mysqld log
remove_file $MYSQLD_LOG;
--echo # delete temp keyring file
remove_file $MYSQL_TMP_DIR/keyring;
--echo # delete datadir
--force-rmdir $DDIR
--echo #
--echo # Bug#29584642 DATABASE INITIALISATION FAILURE WITH INNODB_DEFAULT_ROW_FORMAT=REDUNDANT
--echo #
--echo # The database initialization would fail without the fix.
--exec $MYSQLD $extra_args --datadir=$DDIR --initialize --innodb_default_row_format=redundant > $MYSQLD_LOG 2>&1
--echo # delete mysqld log
remove_file $MYSQLD_LOG;
--echo # delete datadir
--force-rmdir $DDIR
--echo #
--echo # Bug#29780434 MYSQLD --INITIALIZE FAILS IF LOST+FOUND FROM FILESYSTEM IS IN DATADIR
--echo #
--echo # Create the data directory and subdirectories.
--mkdir $DDIR
--echo # Add a sub-directory in it with a name that is not ignored.
--mkdir $DDIR/subdir
--echo # Add a sub-directory in it with a name that is ignored.
--mkdir $DDIR/lost+found
--echo # Add a "hidden" sub-directory, starting with '.'.
--mkdir $DDIR/.hsubdir
--echo # Run the server with --initialize. Should fail due to 'subdir'.
--error 1
--exec $MYSQLD $extra_args --initialize --datadir=$DDIR > $MYSQLD_LOG 2>&1
--echo # Remove the subdirectory which is not accepted, and start the server with --initialize again.
--force-rmdir $DDIR/subdir
--exec $MYSQLD $extra_args --initialize --datadir=$DDIR > $MYSQLD_LOG 2>&1
--echo # Remove data dir and log file.
--remove_file $MYSQLD_LOG
--force-rmdir $DDIR
--echo #
--echo # Bug#31496943: INITIALIZE WITH INNODB_PAGE_SIZE=4096 GETS
--echo # "SPECIFIED KEY WAS TOO LONG" ERRORS
--echo #
let DDIR=$MYSQL_TMP_DIR/initialize_4k;
let MYSQLD_LOG=$MYSQL_TMP_DIR/initialize_4k.err;
--echo # Create bootstrap file which creates test schema (needed for
--echo # wait_until_connected
write_file $BOOTSTRAP_SQL;
CREATE DATABASE test;
EOF
--echo # Run the server with --initialize-insecure and 4K pages.
--exec $MYSQLD --no-defaults --initialize-insecure --innodb_page_size=4K --datadir=$DDIR --init-file=$BOOTSTRAP_SQL >$MYSQLD_LOG 2>&1
--echo # Look for error messages from my_message_stderr (there should be none)
--perl
use strict;
my $log= $ENV{'MYSQLD_LOG'} || die "Failed to read MYSQLD_LOG from env: $!";
open(FILE, "$log") || die "Failed to open error log: $!";
while (<FILE>) {
/mysqld: Specified key was too long/ && print;
}
close(FILE);
EOF
--echo # Restart the server against the 4k DDIR to make sure it can be started
--exec echo "restart:--innodb_page_size=4k --datadir=$DDIR " > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--enable_reconnect
--source include/wait_until_connected_again.inc
SELECT * FROM information_schema.schemata;
--echo # Shut server down
--exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--shutdown_server
--source include/wait_until_disconnected.inc
--echo # Server is down
--echo # Remove 4k data dir, log, and bootstrap file.
--remove_file $MYSQLD_LOG
--remove_file $BOOTSTRAP_SQL
--force-rmdir $DDIR
--echo #
--echo # Cleanup
--echo #
--echo # Restarting the server
--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--enable_reconnect
--source include/wait_until_connected_again.inc
|