1
DROP DATABASE IF EXISTS test1;
2
DROP DATABASE IF EXISTS test2;
5
CREATE TABLE test1.t1 (f1 VARCHAR(20)) ENGINE = <engine_to_be_used>;
6
CREATE TABLE test1.t2 (f1 VARCHAR(20)) ENGINE = <engine_to_be_used>;
7
CREATE TABLE test2.t1 (f1 VARCHAR(20)) ENGINE = <engine_to_be_used>;
10
IF(INSTR(table_comment,'InnoDB free') = 0
11
AND INSTR(table_comment,'number_of_replicas') = 0,
12
LENGTH(table_comment),
13
INSTR(table_comment,'InnoDB free')
14
+ INSTR(table_comment,'number_of_replicas') - 1))
16
'-----------------------------------------------------' AS "Separator"
17
FROM information_schema.tables
18
WHERE table_schema LIKE 'test%' AND table_type = 'BASE TABLE'
19
ORDER BY table_schema,table_name;
37
TABLE_COLLATION latin1_swedish_ci
42
Separator -----------------------------------------------------
60
TABLE_COLLATION latin1_swedish_ci
65
Separator -----------------------------------------------------
83
TABLE_COLLATION latin1_swedish_ci
88
Separator -----------------------------------------------------
89
SHOW TABLES FROM test1;
93
SHOW TABLES FROM test2;
96
DROP USER testuser1@localhost;
97
CREATE USER testuser1@localhost;
98
GRANT SELECT ON test1.* TO testuser1@localhost;
99
# Establish connection testuser1 (user=testuser1)
102
IF(INSTR(table_comment,'InnoDB free') = 0
103
AND INSTR(table_comment,'number_of_replicas') = 0,
104
LENGTH(table_comment),
105
INSTR(table_comment,'InnoDB free')
106
+ INSTR(table_comment,'number_of_replicas') - 1))
108
'-----------------------------------------------------' AS "Separator"
109
FROM information_schema.tables
110
WHERE table_schema LIKE 'test%' AND table_type = 'BASE TABLE'
111
ORDER BY table_schema,table_name;
115
TABLE_TYPE BASE TABLE
122
MAX_DATA_LENGTH #MDL#
129
TABLE_COLLATION latin1_swedish_ci
134
Separator -----------------------------------------------------
138
TABLE_TYPE BASE TABLE
145
MAX_DATA_LENGTH #MDL#
152
TABLE_COLLATION latin1_swedish_ci
157
Separator -----------------------------------------------------
158
SHOW TABLES FROM test1;
162
SHOW TABLES FROM test2;
163
ERROR 42000: Access denied for user 'testuser1'@'localhost' to database 'test2'
164
# Switch to connection default and close connection testuser1
165
DROP USER testuser1@localhost;