~ubuntu-branches/ubuntu/trusty/mariadb-5.5/trusty-proposed

« back to all changes in this revision

Viewing changes to mysql-test/t/mysql_upgrade.test

  • Committer: Package Import Robot
  • Author(s): Otto Kekäläinen
  • Date: 2013-12-22 10:27:05 UTC
  • Revision ID: package-import@ubuntu.com-20131222102705-mndw7s12mz0szrcn
Tags: upstream-5.5.32
Import upstream version 5.5.32

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
-- source include/mysql_upgrade_preparation.inc
 
2
-- source include/have_working_dns.inc
 
3
 
 
4
#
 
5
# Basic test that we can run mysql_upgrde and that it finds the
 
6
# expected binaries it uses.
 
7
#
 
8
--echo Run mysql_upgrade once
 
9
--exec $MYSQL_UPGRADE --force 2>&1
 
10
 
 
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;
 
14
 
 
15
--echo Run it again - should say already completed
 
16
--replace_result $MYSQL_SERVER_VERSION VERSION
 
17
--error 1
 
18
--exec $MYSQL_UPGRADE 2>&1
 
19
 
 
20
# It should have created a file in the MySQL Servers datadir
 
21
file_exists $MYSQLD_DATADIR/mysql_upgrade_info;
 
22
 
 
23
--echo Force should run it regardless of wether it's been run before
 
24
--exec $MYSQL_UPGRADE --force 2>&1
 
25
 
 
26
# It should have created a file in the MySQL Servers datadir
 
27
file_exists $MYSQLD_DATADIR/mysql_upgrade_info;
 
28
 
 
29
 
 
30
#
 
31
# Bug #25452 mysql_upgrade access denied.
 
32
#
 
33
 
 
34
# Password protect a root account and run mysql_upgrade
 
35
 
 
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
 
40
 
 
41
DROP USER mysqltest1@'%';
 
42
 
 
43
 
 
44
#
 
45
# Bug #26639 mysql_upgrade exits successfully even if external command failed
 
46
#
 
47
 
 
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)/
 
51
--error 1
 
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
 
55
 
 
56
#
 
57
# Bug #28401 mysql_upgrade Failed with STRICT_ALL_TABLES, ANSI_QUOTES and NO_ZERO_DATE
 
58
#
 
59
 
 
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.
 
63
 
 
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;
 
68
 
 
69
--echo #
 
70
--echo # Bug #41569 mysql_upgrade (ver 5.1) add 3 fields to mysql.proc table 
 
71
--echo # but does not set values.
 
72
--echo #
 
73
 
 
74
# Create a stored procedure and set the fields in question to null. 
 
75
# When running mysql_upgrade, a warning should be written.
 
76
 
 
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
 
82
CALL testproc();
 
83
DROP PROCEDURE testproc;
 
84
--cat_file $MYSQLTEST_VARDIR/tmp/41569.txt
 
85
--remove_file $MYSQLTEST_VARDIR/tmp/41569.txt
 
86
 
 
87
 
 
88
--echo #
 
89
--echo # Bug #53613: mysql_upgrade incorrectly revokes 
 
90
--echo #   TRIGGER privilege on given table
 
91
--echo #
 
92
 
 
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'@'%';
 
98
 
 
99
DROP USER 'user3'@'%';
 
100
 
 
101
--echo End of 5.1 tests
 
102
 
 
103
 
 
104
#
 
105
# Test the --upgrade-system-tables option
 
106
#
 
107
--replace_result $MYSQLTEST_VARDIR var
 
108
--exec $MYSQL_UPGRADE --force --upgrade-system-tables
 
109
 
 
110
--echo #
 
111
--echo # Bug#11827359 60223: MYSQL_UPGRADE PROBLEM WITH OPTION
 
112
--echo #                     SKIP-WRITE-BINLOG
 
113
--echo #
 
114
 
 
115
let $MYSQLD_DATADIR= `select @@datadir`;
 
116
 
 
117
--echo # Droping the previously created mysql_upgrade_info file..
 
118
--remove_file $MYSQLD_DATADIR/mysql_upgrade_info
 
119
 
 
120
--echo # Running mysql_upgrade with --skip-write-binlog..
 
121
--replace_result $MYSQLTEST_VARDIR var
 
122
--exec $MYSQL_UPGRADE --skip-write-binlog
 
123
 
 
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
 
127
 
 
128
--echo End of tests