stop slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;
drop database if exists d1;
create database d1;
use d1;
create table t (s1 int) engine=innodb;
set @@autocommit=0;
start transaction;
insert into t values (1);
grant select on t to x@y;
rollback;
show grants for x@y;
Grants for x@y
GRANT USAGE ON *.* TO 'x'@'y'
GRANT SELECT ON `d1`.`t` TO 'x'@'y'
show binlog events;
Log_name	Pos	Event_type	Server_id	End_log_pos	Info
master-bin.000001	4	Format_desc	1	106	Server ver: VERSION, Binlog ver: 4
master-bin.000001	106	Query	1	193	drop database if exists d1
master-bin.000001	193	Query	1	272	create database d1
master-bin.000001	272	Query	1	370	use `d1`; create table t (s1 int) engine=innodb
master-bin.000001	370	Query	1	436	BEGIN
master-bin.000001	436	Query	1	521	use `d1`; insert into t values (1)
master-bin.000001	521	Xid	1	548	COMMIT /* XID */
master-bin.000001	548	Query	1	633	use `d1`; grant select on t to x@y
start transaction;
insert into t values (2);
revoke select on t from x@y;
commit;
select * from t;
s1
1
2
show grants for x@y;
Grants for x@y
GRANT USAGE ON *.* TO 'x'@'y'
show binlog events;
Log_name	Pos	Event_type	Server_id	End_log_pos	Info
master-bin.000001	4	Format_desc	1	106	Server ver: VERSION, Binlog ver: 4
master-bin.000001	106	Query	1	193	drop database if exists d1
master-bin.000001	193	Query	1	272	create database d1
master-bin.000001	272	Query	1	370	use `d1`; create table t (s1 int) engine=innodb
master-bin.000001	370	Query	1	436	BEGIN
master-bin.000001	436	Query	1	521	use `d1`; insert into t values (1)
master-bin.000001	521	Xid	1	548	COMMIT /* XID */
master-bin.000001	548	Query	1	633	use `d1`; grant select on t to x@y
master-bin.000001	633	Query	1	699	BEGIN
master-bin.000001	699	Query	1	784	use `d1`; insert into t values (2)
master-bin.000001	784	Xid	1	811	COMMIT /* XID */
master-bin.000001	811	Query	1	899	use `d1`; revoke select on t from x@y
drop user x@y;
drop database d1;
