1
# Can't run test of external client with embedded server
2
-- source include/not_embedded.inc
4
# Only run test if "mysql_upgrade" is found
5
--require r/have_mysql_upgrade.result
7
select LENGTH("$MYSQL_UPGRADE")>0 as have_mysql_upgrade;
13
# If running with Valgrind ($VALGRIND_TEST <> 0) then the resource
14
# consumption (CPU) for upgrading a large log table will be intense.
15
# Therefore, truncate the log table in advance and issue a statement
16
# that should be logged.
18
if (`SELECT $VALGRIND_TEST`)
22
--disable_abort_on_error
23
TRUNCATE TABLE mysql.general_log;
25
--enable_abort_on_error
31
# Basic test that we can run mysql_upgrde and that it finds the
32
# expected binaries it uses.
34
--echo Run mysql_upgrade once
35
--exec $MYSQL_UPGRADE --skip-verbose 2>&1
37
# It should have created a file in the MySQL Servers datadir
38
let $MYSQLD_DATADIR= `select @@datadir`;
39
file_exists $MYSQLD_DATADIR/mysql_upgrade_info;
41
--echo Run it again - should say already completed
42
--replace_result $MYSQL_SERVER_VERSION VERSION
44
--exec $MYSQL_UPGRADE --skip-verbose 2>&1
46
# It should have created a file in the MySQL Servers datadir
47
file_exists $MYSQLD_DATADIR/mysql_upgrade_info;
49
--echo Force should run it regardless of wether it's been run before
50
--exec $MYSQL_UPGRADE --skip-verbose --force 2>&1
52
# It should have created a file in the MySQL Servers datadir
53
file_exists $MYSQLD_DATADIR/mysql_upgrade_info;
57
# Bug #25452 mysql_upgrade access denied.
60
# Password protect a root account and run mysql_upgrade
62
CREATE USER mysqltest1@'%' IDENTIFIED by 'sakila';
63
GRANT ALL ON *.* TO mysqltest1@'%';
64
--echo Run mysql_upgrade with password protected account
65
--exec $MYSQL_UPGRADE --skip-verbose --force --user=mysqltest1 --password=sakila 2>&1
67
DROP USER mysqltest1@'%';
71
# Bug #26639 mysql_upgrade exits successfully even if external command failed
74
--echo Run mysql_upgrade with a non existing server socket
75
--replace_result $MYSQLTEST_VARDIR var
76
--replace_regex /.*mysqlcheck.*: Got/mysqlcheck: Got/ /\([0-9]*\)/(errno)/
78
--exec $MYSQL_UPGRADE --skip-verbose --force --host=not_existing_host 2>&1
81
# Bug #28401 mysql_upgrade Failed with STRICT_ALL_TABLES, ANSI_QUOTES and NO_ZERO_DATE
84
# The SQL commands used by mysql_upgrade are written to be run
85
# with sql_mode set to '' - thus the scripts should change sql_mode
86
# for the session to make sure the SQL is legal.
88
# Test by setting sql_mode before running mysql_upgrade
89
set GLOBAL sql_mode='STRICT_ALL_TABLES,ANSI_QUOTES,NO_ZERO_DATE';
90
--exec $MYSQL_UPGRADE --skip-verbose --force 2>&1
91
eval set GLOBAL sql_mode=default;
95
--echo # Bug #41569 mysql_upgrade (ver 5.1) add 3 fields to mysql.proc table
96
--echo # but does not set values.
99
# Create a stored procedure and set the fields in question to null.
100
# When running mysql_upgrade, a warning should be written.
102
CREATE PROCEDURE testproc() BEGIN END;
103
UPDATE mysql.proc SET character_set_client = NULL WHERE name LIKE 'testproc';
104
UPDATE mysql.proc SET collation_connection = NULL WHERE name LIKE 'testproc';
105
UPDATE mysql.proc SET db_collation = NULL WHERE name LIKE 'testproc';
106
--exec $MYSQL_UPGRADE --skip-verbose --force 2> $MYSQLTEST_VARDIR/tmp/41569.txt
108
DROP PROCEDURE testproc;
109
--cat_file $MYSQLTEST_VARDIR/tmp/41569.txt
110
--remove_file $MYSQLTEST_VARDIR/tmp/41569.txt