1
-- source include/mysql_upgrade_preparation.inc
2
-- source include/have_working_dns.inc
5
# Basic test that we can run mysql_upgrde and that it finds the
6
# expected binaries it uses.
8
--echo Run mysql_upgrade once
9
--exec $MYSQL_UPGRADE --force 2>&1
11
# It should have created a file in the MySQL Servers datadir
12
let $MYSQLD_DATADIR= `select @@datadir`;
13
file_exists $MYSQLD_DATADIR/mysql_upgrade_info;
15
--echo Run it again - should say already completed
16
--replace_result $MYSQL_SERVER_VERSION VERSION
18
--exec $MYSQL_UPGRADE 2>&1
20
# It should have created a file in the MySQL Servers datadir
21
file_exists $MYSQLD_DATADIR/mysql_upgrade_info;
23
--echo Force should run it regardless of wether it's been run before
24
--exec $MYSQL_UPGRADE --force 2>&1
26
# It should have created a file in the MySQL Servers datadir
27
file_exists $MYSQLD_DATADIR/mysql_upgrade_info;
31
# Bug #25452 mysql_upgrade access denied.
34
# Password protect a root account and run mysql_upgrade
36
CREATE USER mysqltest1@'%' IDENTIFIED by 'sakila';
37
GRANT ALL ON *.* TO mysqltest1@'%';
38
--echo Run mysql_upgrade with password protected account
39
--exec $MYSQL_UPGRADE --force --user=mysqltest1 --password=sakila 2>&1
41
DROP USER mysqltest1@'%';
45
# Bug #26639 mysql_upgrade exits successfully even if external command failed
48
--echo Run mysql_upgrade with a non existing server socket
49
--replace_result $MYSQLTEST_VARDIR var
50
--replace_regex /.*mysqlcheck.*: Got/mysqlcheck: Got/ /\([0-9]*\)/(errno)/
52
# NC: Added --skip-version-check, as the version check would fail when
53
# mysql_upgrade tries to get the server version.
54
--exec $MYSQL_UPGRADE --verbose --force --host=not_existing_host --skip-version-check 2>&1
57
# Bug #28401 mysql_upgrade Failed with STRICT_ALL_TABLES, ANSI_QUOTES and NO_ZERO_DATE
60
# The SQL commands used by mysql_upgrade are written to be run
61
# with sql_mode set to '' - thus the scripts should change sql_mode
62
# for the session to make sure the SQL is legal.
64
# Test by setting sql_mode before running mysql_upgrade
65
set GLOBAL sql_mode='STRICT_ALL_TABLES,ANSI_QUOTES,NO_ZERO_DATE';
66
--exec $MYSQL_UPGRADE --force 2>&1
67
eval set GLOBAL sql_mode=default;
70
--echo # Bug #41569 mysql_upgrade (ver 5.1) add 3 fields to mysql.proc table
71
--echo # but does not set values.
74
# Create a stored procedure and set the fields in question to null.
75
# When running mysql_upgrade, a warning should be written.
77
CREATE PROCEDURE testproc() BEGIN END;
78
UPDATE mysql.proc SET character_set_client = NULL WHERE name LIKE 'testproc';
79
UPDATE mysql.proc SET collation_connection = NULL WHERE name LIKE 'testproc';
80
UPDATE mysql.proc SET db_collation = NULL WHERE name LIKE 'testproc';
81
--exec $MYSQL_UPGRADE --force 2> $MYSQLTEST_VARDIR/tmp/41569.txt
83
DROP PROCEDURE testproc;
84
--cat_file $MYSQLTEST_VARDIR/tmp/41569.txt
85
--remove_file $MYSQLTEST_VARDIR/tmp/41569.txt
89
--echo # Bug #53613: mysql_upgrade incorrectly revokes
90
--echo # TRIGGER privilege on given table
93
GRANT USAGE ON *.* TO 'user3'@'%';
94
GRANT ALL PRIVILEGES ON `roelt`.`test2` TO 'user3'@'%';
95
--echo Run mysql_upgrade with all privileges on a user
96
--exec $MYSQL_UPGRADE --force 2>&1
97
SHOW GRANTS FOR 'user3'@'%';
99
DROP USER 'user3'@'%';
101
--echo End of 5.1 tests
105
# Test the --upgrade-system-tables option
107
--replace_result $MYSQLTEST_VARDIR var
108
--exec $MYSQL_UPGRADE --force --upgrade-system-tables
111
--echo # Bug#11827359 60223: MYSQL_UPGRADE PROBLEM WITH OPTION
112
--echo # SKIP-WRITE-BINLOG
115
let $MYSQLD_DATADIR= `select @@datadir`;
117
--echo # Droping the previously created mysql_upgrade_info file..
118
--remove_file $MYSQLD_DATADIR/mysql_upgrade_info
120
--echo # Running mysql_upgrade with --skip-write-binlog..
121
--replace_result $MYSQLTEST_VARDIR var
122
--exec $MYSQL_UPGRADE --skip-write-binlog
124
# mysql_upgrade must have created mysql_upgrade_info file,
125
# so the following command should never fail.
126
--remove_file $MYSQLD_DATADIR/mysql_upgrade_info