summaryrefslogtreecommitdiff
path: root/mysql-test/t/system_mysql_db_fix.test
blob: 1539d210a3ad722989d56a4d9f55aacc87b7fc7a (plain)
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
#
# This is the test for mysql_fix_privilege_tables
#

-- disable_result_log
-- disable_query_log

use test;

# create system tables as in mysql-3.20

--disable_warnings
CREATE TABLE db (
  Host char(60) binary DEFAULT '' NOT NULL,
  Db char(32) binary DEFAULT '' NOT NULL,
  User char(16) binary DEFAULT '' NOT NULL,
  Select_priv enum('N','Y') DEFAULT 'N' NOT NULL,
  Insert_priv enum('N','Y') DEFAULT 'N' NOT NULL,
  Update_priv enum('N','Y') DEFAULT 'N' NOT NULL,
  Delete_priv enum('N','Y') DEFAULT 'N' NOT NULL,
  Create_priv enum('N','Y') DEFAULT 'N' NOT NULL,
  Drop_priv enum('N','Y') DEFAULT 'N' NOT NULL,
  PRIMARY KEY Host (Host,Db,User),
  KEY User (User)
)
type=ISAM;
--enable-warnings

INSERT INTO db VALUES ('%','test',   '','Y','Y','Y','Y','Y','Y');
INSERT INTO db VALUES ('%','test\_%','','Y','Y','Y','Y','Y','Y');

--disable_warnings
CREATE TABLE host (
  Host char(60) binary DEFAULT '' NOT NULL,
  Db char(32) binary DEFAULT '' NOT NULL,
  Select_priv enum('N','Y') DEFAULT 'N' NOT NULL,
  Insert_priv enum('N','Y') DEFAULT 'N' NOT NULL,
  Update_priv enum('N','Y') DEFAULT 'N' NOT NULL,
  Delete_priv enum('N','Y') DEFAULT 'N' NOT NULL,
  Create_priv enum('N','Y') DEFAULT 'N' NOT NULL,
  Drop_priv enum('N','Y') DEFAULT 'N' NOT NULL,
  PRIMARY KEY Host (Host,Db)
)
type=ISAM;
--enable-warnings

--disable_warnings
CREATE TABLE user (
  Host char(60) binary DEFAULT '' NOT NULL,
  User char(16) binary DEFAULT '' NOT NULL,
  Password char(16),
  Select_priv enum('N','Y') DEFAULT 'N' NOT NULL,
  Insert_priv enum('N','Y') DEFAULT 'N' NOT NULL,
  Update_priv enum('N','Y') DEFAULT 'N' NOT NULL,
  Delete_priv enum('N','Y') DEFAULT 'N' NOT NULL,
  Create_priv enum('N','Y') DEFAULT 'N' NOT NULL,
  Drop_priv enum('N','Y') DEFAULT 'N' NOT NULL,
  Reload_priv enum('N','Y') DEFAULT 'N' NOT NULL,
  Shutdown_priv enum('N','Y') DEFAULT 'N' NOT NULL,
  Process_priv enum('N','Y') DEFAULT 'N' NOT NULL,
  PRIMARY KEY Host (Host,User)
)
type=ISAM;
--enable-warnings

INSERT INTO user VALUES ('localhost','root','','Y','Y','Y','Y','Y','Y','Y','Y','Y');
INSERT INTO user VALUES ('localhost','',    '','N','N','N','N','N','N','N','N','N');

-- exec $MYSQL_FIX_SYSTEM_TABLES --database=test
-- enable_query_log
-- enable_result_log

-- source include/system_db_struct.inc

-- disable_query_log

DROP TABLE db, host, user, func, tables_priv, columns_priv, help_category, help_keyword, help_relation, help_topic, time_zone, time_zone_leap_second, time_zone_name, time_zone_transition, time_zone_transition_type;

-- enable_query_log

# check that we droped all system tables
show tables;