| 1 |
include/master-slave.inc |
| 2 |
[connection master] |
| 3 |
call mtr.add_suppression("Can't find record in 't.'"); |
| 4 |
call mtr.add_suppression("Can't find record in 'global_priv'"); |
| 5 |
call mtr.add_suppression("Can't find record in 'tables_priv'"); |
| 6 |
**** Test case for BUG#16487 **** |
| 7 |
connection master; |
| 8 |
CREATE TABLE test.t4 (a int); |
| 9 |
CREATE TABLE test.t1 (a int); |
| 10 |
UPDATE test.t4 NATURAL JOIN test.t1 SET t1.a=5; |
| 11 |
connection slave; |
| 12 |
SELECT * FROM t4; |
| 13 |
a |
| 14 |
connection master; |
| 15 |
DROP TABLE t1; |
| 16 |
DROP TABLE t4; |
| 17 |
connection slave; |
| 18 |
**** Test case for BUG#25482 **** |
| 19 |
**** Adding GRANTS on master **** |
| 20 |
connection master; |
| 21 |
create table test.t1(a int); |
| 22 |
create table test.t4(a int); |
| 23 |
set sql_mode=""; |
| 24 |
GRANT SELECT ON test.t1 TO mysqltest1@localhost; |
| 25 |
GRANT INSERT ON test.t4 TO mysqltest2@localhost; |
| 26 |
GRANT select, update, insert, references on t1 |
| 27 |
to mysqltest2@localhost; |
| 28 |
GRANT SELECT ON test.* TO mysqltest3@localhost; |
| 29 |
GRANT INSERT ON test.t4 TO mysqltest3@localhost; |
| 30 |
GRANT select(a), update(a), insert(a), references(a) on t4 |
| 31 |
to mysqltest3@localhost; |
| 32 |
create database mysqltest2; |
| 33 |
create table mysqltest2.t2 (id int); |
| 34 |
GRANT SELECT ON mysqltest2.t2 TO mysqltest4@localhost IDENTIFIED BY 'pass'; |
| 35 |
insert into mysql.global_priv (user, host) values ("mysqltest5", "somehost"); |
| 36 |
GRANT SELECT ON *.* TO mysqltest6@localhost; |
| 37 |
GRANT INSERT ON *.* TO mysqltest6@localhost; |
| 38 |
GRANT INSERT ON test.* TO mysqltest6@localhost; |
| 39 |
GRANT INSERT ON test.t1 TO mysqltest6@localhost; |
| 40 |
show grants for mysqltest1@localhost; |
| 41 |
Grants for mysqltest1@localhost |
| 42 |
GRANT SELECT ON `test`.`t1` TO `mysqltest1`@`localhost` |
| 43 |
GRANT USAGE ON *.* TO `mysqltest1`@`localhost` |
| 44 |
show grants for mysqltest2@localhost; |
| 45 |
Grants for mysqltest2@localhost |
| 46 |
GRANT INSERT ON `test`.`t4` TO `mysqltest2`@`localhost` |
| 47 |
GRANT SELECT, INSERT, UPDATE, REFERENCES ON `test`.`t1` TO `mysqltest2`@`localhost` |
| 48 |
GRANT USAGE ON *.* TO `mysqltest2`@`localhost` |
| 49 |
show grants for mysqltest3@localhost; |
| 50 |
Grants for mysqltest3@localhost |
| 51 |
GRANT SELECT (`a`), INSERT, INSERT (`a`), UPDATE (`a`), REFERENCES (`a`) ON `test`.`t4` TO `mysqltest3`@`localhost` |
| 52 |
GRANT SELECT ON `test`.* TO `mysqltest3`@`localhost` |
| 53 |
GRANT USAGE ON *.* TO `mysqltest3`@`localhost` |
| 54 |
show grants for mysqltest4@localhost; |
| 55 |
Grants for mysqltest4@localhost |
| 56 |
GRANT SELECT ON `mysqltest2`.`t2` TO `mysqltest4`@`localhost` |
| 57 |
GRANT USAGE ON *.* TO `mysqltest4`@`localhost` IDENTIFIED BY PASSWORD '*196BDEDE2AE4F84CA44C47D54D78478C7E2BD7B7' |
| 58 |
show grants for mysqltest6@localhost; |
| 59 |
Grants for mysqltest6@localhost |
| 60 |
GRANT INSERT ON `test`.* TO `mysqltest6`@`localhost` |
| 61 |
GRANT INSERT ON `test`.`t1` TO `mysqltest6`@`localhost` |
| 62 |
GRANT SELECT, INSERT ON *.* TO `mysqltest6`@`localhost` |
| 63 |
flush privileges; |
| 64 |
show grants for mysqltest5@somehost; |
| 65 |
Grants for mysqltest5@somehost |
| 66 |
GRANT USAGE ON *.* TO `mysqltest5`@`somehost` |
| 67 |
set sql_mode=""; |
| 68 |
connection slave; |
| 69 |
**** Checking grants on slave **** |
| 70 |
show grants for mysqltest2@localhost; |
| 71 |
Grants for mysqltest2@localhost |
| 72 |
GRANT INSERT ON `test`.`t4` TO `mysqltest2`@`localhost` |
| 73 |
GRANT USAGE ON *.* TO `mysqltest2`@`localhost` |
| 74 |
show grants for mysqltest3@localhost; |
| 75 |
Grants for mysqltest3@localhost |
| 76 |
GRANT SELECT (`a`), INSERT, INSERT (`a`), UPDATE (`a`), REFERENCES (`a`) ON `test`.`t4` TO `mysqltest3`@`localhost` |
| 77 |
GRANT SELECT ON `test`.* TO `mysqltest3`@`localhost` |
| 78 |
GRANT USAGE ON *.* TO `mysqltest3`@`localhost` |
| 79 |
show grants for mysqltest4@localhost; |
| 80 |
Grants for mysqltest4@localhost |
| 81 |
GRANT SELECT ON `mysqltest2`.`t2` TO `mysqltest4`@`localhost` |
| 82 |
GRANT USAGE ON *.* TO `mysqltest4`@`localhost` IDENTIFIED BY PASSWORD '*196BDEDE2AE4F84CA44C47D54D78478C7E2BD7B7' |
| 83 |
show grants for mysqltest5@somehost; |
| 84 |
Grants for mysqltest5@somehost |
| 85 |
GRANT USAGE ON *.* TO `mysqltest5`@`somehost` |
| 86 |
show grants for mysqltest6@localhost; |
| 87 |
Grants for mysqltest6@localhost |
| 88 |
GRANT INSERT ON `test`.* TO `mysqltest6`@`localhost` |
| 89 |
GRANT SELECT, INSERT ON *.* TO `mysqltest6`@`localhost` |
| 90 |
show grants for mysqltest1@localhost; |
| 91 |
ERROR 42000: There is no such grant defined for user 'mysqltest1' on host 'localhost' |
| 92 |
**** Revoking grants on master **** |
| 93 |
connection master; |
| 94 |
REVOKE SELECT ON test.t1 FROM mysqltest1@localhost; |
| 95 |
REVOKE SELECT ON mysqltest2.t2 FROM mysqltest4@localhost; |
| 96 |
REVOKE select(a) on t4 |
| 97 |
from mysqltest3@localhost; |
| 98 |
show grants for mysqltest1@localhost; |
| 99 |
Grants for mysqltest1@localhost |
| 100 |
GRANT USAGE ON *.* TO `mysqltest1`@`localhost` |
| 101 |
show grants for mysqltest3@localhost; |
| 102 |
Grants for mysqltest3@localhost |
| 103 |
GRANT INSERT, INSERT (`a`), UPDATE (`a`), REFERENCES (`a`) ON `test`.`t4` TO `mysqltest3`@`localhost` |
| 104 |
GRANT SELECT ON `test`.* TO `mysqltest3`@`localhost` |
| 105 |
GRANT USAGE ON *.* TO `mysqltest3`@`localhost` |
| 106 |
show grants for mysqltest4@localhost; |
| 107 |
Grants for mysqltest4@localhost |
| 108 |
GRANT USAGE ON *.* TO `mysqltest4`@`localhost` IDENTIFIED BY PASSWORD '*196BDEDE2AE4F84CA44C47D54D78478C7E2BD7B7' |
| 109 |
connection slave; |
| 110 |
**** Checking grants on slave **** |
| 111 |
show grants for mysqltest1@localhost; |
| 112 |
ERROR 42000: There is no such grant defined for user 'mysqltest1' on host 'localhost' |
| 113 |
show grants for mysqltest3@localhost; |
| 114 |
Grants for mysqltest3@localhost |
| 115 |
GRANT USAGE ON *.* TO `mysqltest3`@`localhost` |
| 116 |
GRANT SELECT ON `test`.* TO `mysqltest3`@`localhost` |
| 117 |
GRANT INSERT, INSERT (`a`), UPDATE (`a`), REFERENCES (`a`) ON `test`.`t4` TO `mysqltest3`@`localhost` |
| 118 |
show grants for mysqltest4@localhost; |
| 119 |
Grants for mysqltest4@localhost |
| 120 |
GRANT USAGE ON *.* TO `mysqltest4`@`localhost` IDENTIFIED BY PASSWORD '*196BDEDE2AE4F84CA44C47D54D78478C7E2BD7B7' |
| 121 |
set global slave_exec_mode='IDEMPOTENT'; |
| 122 |
call mtr.add_suppression("Slave SQL.*Could not execute Delete_rows event on table mysql.* error.* 1032"); |
| 123 |
connection master; |
| 124 |
drop table t1, mysqltest2.t2; |
| 125 |
drop table t4; |
| 126 |
drop database mysqltest2; |
| 127 |
delete from mysql.user where user like "mysqltest%"; |
| 128 |
delete from mysql.db where user like "mysqltest%"; |
| 129 |
delete from mysql.columns_priv where user like "mysqltest%"; |
| 130 |
connection slave; |
| 131 |
delete from mysql.tables_priv where user like "mysqltest%"; |
| 132 |
connection master; |
| 133 |
delete from mysql.tables_priv where user like "mysqltest%"; |
| 134 |
connection master; |
| 135 |
DROP TABLE IF EXISTS t5; |
| 136 |
CREATE TABLE t5 ( |
| 137 |
word varchar(50) collate utf8_unicode_ci NOT NULL default '' |
| 138 |
) DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; |
| 139 |
SET @@session.character_set_client=33,@@session.collation_connection=192; |
| 140 |
CREATE TEMPORARY TABLE tmptbl504451f4258$1 (id INT NOT NULL) ENGINE=MEMORY; |
| 141 |
INSERT INTO t5 (word) VALUES ('TEST’'); |
| 142 |
SELECT HEX(word) FROM t5; |
| 143 |
HEX(word) |
| 144 |
54455354E28099 |
| 145 |
connection slave; |
| 146 |
set @@global.slave_exec_mode= default; |
| 147 |
connection slave; |
| 148 |
SELECT HEX(word) FROM t5; |
| 149 |
HEX(word) |
| 150 |
54455354E28099 |
| 151 |
SELECT * FROM tmptbl504451f4258$1; |
| 152 |
ERROR 42S02: Table 'test.tmptbl504451f4258$1' doesn't exist |
| 153 |
connection master; |
| 154 |
DROP TABLE t5; |
| 155 |
flush privileges; |
| 156 |
connection slave; |
| 157 |
include/rpl_end.inc |