system_mysql_db_fix.test 2.55 KB
Newer Older
1
#
2
# This is the test for mysql_fix_privilege_tables
3
#
4

5 6
-- disable_result_log
-- disable_query_log
monty@mysql.com's avatar
monty@mysql.com committed
7

8
use test;
monty@mysql.com's avatar
monty@mysql.com committed
9

10
# create system tables as in mysql-3.20
monty@mysql.com's avatar
monty@mysql.com committed
11

12
--disable_warnings
13 14 15 16 17 18 19 20 21 22 23 24 25 26
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;
27
--enable-warnings
28 29 30 31

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

32
--disable_warnings
33 34 35 36 37 38 39 40 41 42 43 44
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;
45
--enable-warnings
46

47
--disable_warnings
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63
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;
64
--enable-warnings
65 66 67

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');
monty@mysql.com's avatar
monty@mysql.com committed
68

69
-- exec $MYSQL_FIX_SYSTEM_TABLES --database=test
70 71 72 73 74 75 76
-- enable_query_log
-- enable_result_log

-- source include/system_db_struct.inc

-- disable_query_log

77
DROP TABLE db, host, user, func, tables_priv, columns_priv, procs_priv, help_category, help_keyword, help_relation, help_topic, proc, time_zone, time_zone_leap_second, time_zone_name, time_zone_transition, time_zone_transition_type;
serg@serg.mylan's avatar
serg@serg.mylan committed
78

79
-- enable_query_log
80 81 82

# check that we droped all system tables
show tables;