1
by brian
clean slate |
1 |
# Don't run this test if $MYSQL_FIX_SYSTEM_TABLES isn't set |
2 |
# to the location of mysql_fix_privilege_tables.sql |
|
3 |
if (`SELECT LENGTH("$MYSQL_FIX_SYSTEM_TABLES") <= 0`) |
|
4 |
{
|
|
5 |
skip Test need MYSQL_FIX_SYSTEM_TABLES; |
|
6 |
}
|
|
7 |
# check that CSV engine was compiled in, as the test relies on the presence |
|
8 |
# of the log tables (which are CSV-based) |
|
9 |
--source include/have_csv.inc
|
|
10 |
||
11 |
#
|
|
12 |
# This is the test for mysql_fix_privilege_tables |
|
13 |
# It checks that a system tables from mysql 3.20 |
|
14 |
# can be upgraded to current system table format |
|
15 |
#
|
|
16 |
# Note: If this test fails, don't be confused about the errors reported |
|
17 |
# by mysql-test-run This shows warnings generated by
|
|
18 |
# mysql_fix_system_tables which should be ignored.
|
|
19 |
# Instead, concentrate on the errors in r/system_mysql_db.reject
|
|
20 |
||
21 |
--disable_warnings
|
|
22 |
drop table if exists t1,t1aa,t2aa;
|
|
23 |
--enable_warnings
|
|
24 |
||
25 |
-- disable_result_log
|
|
26 |
-- disable_query_log
|
|
27 |
||
28 |
use test;
|
|
29 |
||
30 |
# create system tables as in mysql-3.20
|
|
31 |
||
32 |
--disable_warnings
|
|
33 |
CREATE TABLE db (
|
|
34 |
Host char(60) binary DEFAULT '' NOT NULL,
|
|
35 |
Db char(32) binary DEFAULT '' NOT NULL,
|
|
36 |
User char(16) binary DEFAULT '' NOT NULL,
|
|
37 |
Select_priv enum('N','Y') DEFAULT 'N' NOT NULL, |
|
38 |
Insert_priv enum('N','Y') DEFAULT 'N' NOT NULL, |
|
39 |
Update_priv enum('N','Y') DEFAULT 'N' NOT NULL, |
|
40 |
Delete_priv enum('N','Y') DEFAULT 'N' NOT NULL, |
|
41 |
Create_priv enum('N','Y') DEFAULT 'N' NOT NULL, |
|
42 |
Drop_priv enum('N','Y') DEFAULT 'N' NOT NULL, |
|
43 |
PRIMARY KEY Host (Host,Db,User),
|
|
44 |
KEY User (User)
|
|
45 |
)
|
|
46 |
engine=MyISAM;
|
|
47 |
--enable_warnings
|
|
48 |
||
49 |
INSERT INTO db VALUES ('%','test', '','Y','Y','Y','Y','Y','Y'); |
|
50 |
INSERT INTO db VALUES ('%','test\_%','','Y','Y','Y','Y','Y','Y'); |
|
51 |
||
52 |
--disable_warnings
|
|
53 |
CREATE TABLE host (
|
|
54 |
Host char(60) binary DEFAULT '' NOT NULL,
|
|
55 |
Db char(32) binary DEFAULT '' NOT NULL,
|
|
56 |
Select_priv enum('N','Y') DEFAULT 'N' NOT NULL, |
|
57 |
Insert_priv enum('N','Y') DEFAULT 'N' NOT NULL, |
|
58 |
Update_priv enum('N','Y') DEFAULT 'N' NOT NULL, |
|
59 |
Delete_priv enum('N','Y') DEFAULT 'N' NOT NULL, |
|
60 |
Create_priv enum('N','Y') DEFAULT 'N' NOT NULL, |
|
61 |
Drop_priv enum('N','Y') DEFAULT 'N' NOT NULL, |
|
62 |
PRIMARY KEY Host (Host,Db)
|
|
63 |
)
|
|
64 |
engine=MyISAM;
|
|
65 |
--enable_warnings
|
|
66 |
||
67 |
--disable_warnings
|
|
68 |
CREATE TABLE user (
|
|
69 |
Host char(60) binary DEFAULT '' NOT NULL,
|
|
70 |
User char(16) binary DEFAULT '' NOT NULL,
|
|
71 |
Password char(16),
|
|
72 |
Select_priv enum('N','Y') DEFAULT 'N' NOT NULL, |
|
73 |
Insert_priv enum('N','Y') DEFAULT 'N' NOT NULL, |
|
74 |
Update_priv enum('N','Y') DEFAULT 'N' NOT NULL, |
|
75 |
Delete_priv enum('N','Y') DEFAULT 'N' NOT NULL, |
|
76 |
Create_priv enum('N','Y') DEFAULT 'N' NOT NULL, |
|
77 |
Drop_priv enum('N','Y') DEFAULT 'N' NOT NULL, |
|
78 |
Reload_priv enum('N','Y') DEFAULT 'N' NOT NULL, |
|
79 |
Shutdown_priv enum('N','Y') DEFAULT 'N' NOT NULL, |
|
80 |
Process_priv enum('N','Y') DEFAULT 'N' NOT NULL, |
|
81 |
PRIMARY KEY Host (Host,User)
|
|
82 |
)
|
|
83 |
engine=MyISAM;
|
|
84 |
--enable_warnings
|
|
85 |
||
86 |
INSERT INTO user VALUES ('localhost','root','','Y','Y','Y','Y','Y','Y','Y','Y','Y'); |
|
87 |
INSERT INTO user VALUES ('localhost','', '','N','N','N','N','N','N','N','N','N'); |
|
88 |
||
89 |
# Call the "shell script" $MYSQL_FIX_SYSTEM_TABLES using system |
|
90 |
-- system $MYSQL_FIX_SYSTEM_TABLES --database=test > $MYSQLTEST_VARDIR/log/system_mysql_db_fix30020.log 2>&1
|
|
91 |
-- enable_query_log
|
|
92 |
-- enable_result_log
|
|
93 |
||
94 |
-- source include/system_db_struct.inc
|
|
95 |
||
96 |
-- disable_query_log
|
|
97 |
||
98 |
DROP TABLE db, host, user, func, plugin, tables_priv, columns_priv, |
|
99 |
procs_priv, servers, help_category, help_keyword, help_relation, help_topic, proc, |
|
100 |
time_zone, time_zone_leap_second, time_zone_name, time_zone_transition, |
|
101 |
time_zone_transition_type, general_log, slow_log, event, ndb_binlog_index, |
|
102 |
online_backup, online_backup_progress; |
|
103 |
||
104 |
-- enable_query_log
|
|
105 |
||
106 |
# check that we dropped all system tables |
|
107 |
show tables; |
|
108 |
||
109 |
# End of 4.1 tests |