Debian Codegraph @

mysql-test/suite/rpl/t/rpl_ignore_grant.test

raw
1 # Test that GRANT is not replicated to the slave
2 # when --replicate-wild-ignore-table=mysql.%
3 # In BUG#980, this test would _randomly_ fail.
4
5 source include/master-slave.inc;
6
7 # do not be influenced by other tests.
8 connection master;
9 set sql_mode="";
10 delete from mysql.user where user=_binary'rpl_ignore_grant';
11 delete from mysql.db where user=_binary'rpl_ignore_grant';
12 flush privileges;
13 --sync_slave_with_master
14 set sql_mode="";
15 # as these DELETE were not replicated, we need to do them manually on the
16 # slave.
17 delete from mysql.user where user=_binary'rpl_ignore_grant';
18 delete from mysql.db where user=_binary'rpl_ignore_grant';
19 flush privileges;
20
21 # test non-replication of GRANT
22 connection master;
23 grant select on *.* to rpl_ignore_grant@localhost;
24 grant drop on test.* to rpl_ignore_grant@localhost;
25 show grants for rpl_ignore_grant@localhost;
26 --sync_slave_with_master
27 --error 1141 #("no such grant for user")
28 show grants for rpl_ignore_grant@localhost;
29 # check it another way
30 select count(*) from mysql.user where user=_binary'rpl_ignore_grant';
31 select count(*) from mysql.db where user=_binary'rpl_ignore_grant';
32
33 # test non-replication of SET PASSWORD
34 # first force creation of the user on slave (because as the user does not exist
35 # on slave, the SET PASSWORD may be replicated but silently do nothing; this is
36 # not what we want; we want it to be not-replicated).
37 grant select on *.* to rpl_ignore_grant@localhost;
38 connection master;
39 set password for rpl_ignore_grant@localhost=password("does it work?");
40 --sync_slave_with_master
41 select password<>_binary'' from mysql.user where user=_binary'rpl_ignore_grant';
42
43 # clear what we have done, to not influence other tests.
44 connection master;
45 delete from mysql.user where user=_binary'rpl_ignore_grant';
46 delete from mysql.db where user=_binary'rpl_ignore_grant';
47 flush privileges;
48 --sync_slave_with_master
49 delete from mysql.user where user=_binary'rpl_ignore_grant';
50 delete from mysql.db where user=_binary'rpl_ignore_grant';
51 flush privileges;
52
53 connection master;
54 # End of 4.1 tests
55 --source include/rpl_end.inc