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/not_group_replication_plugin.inc
6 source include/set_privilege_checks_user_as_system_user.inc;
7 let $rpl_privilege_checks_user_grant_option = 1;
8 source include/master-slave.inc;
9
10 # do not be influenced by other tests.
11 connection master;
12 delete from mysql.user where user=_binary'rpl_ignore_grant';
13 delete from mysql.db where user=_binary'rpl_ignore_grant';
14 flush privileges;
15 save_master_pos;
16 connection slave;
17 sync_with_master;
18 # as these DELETE were not replicated, we need to do them manually on the
19 # slave.
20 delete from mysql.user where user=_binary'rpl_ignore_grant';
21 delete from mysql.db where user=_binary'rpl_ignore_grant';
22 flush privileges;
23
24 # test non-replication of GRANT
25 connection master;
26 create user rpl_ignore_grant@localhost;
27 grant select on *.* to rpl_ignore_grant@localhost;
28 grant drop on test.* to rpl_ignore_grant@localhost;
29 show grants for rpl_ignore_grant@localhost;
30 save_master_pos;
31 connection slave;
32 sync_with_master;
33 # No such grant for user
34 --error 1141
35 show grants for rpl_ignore_grant@localhost;
36 # check it another way
37 select count(*) from mysql.user where user=_binary'rpl_ignore_grant';
38 select count(*) from mysql.db where user=_binary'rpl_ignore_grant';
39
40 # test non-replication of SET PASSWORD
41 # first force creation of the user on slave (because as the user does not exist
42 # on slave, the SET PASSWORD may be replicated but silently do nothing; this is
43 # not what we want; we want it to be not-replicated).
44 create user rpl_ignore_grant@localhost;
45 grant select on *.* to rpl_ignore_grant@localhost;
46 connection master;
47 set password for rpl_ignore_grant@localhost="does it work?";
48 save_master_pos;
49 connection slave;
50 sync_with_master;
51 select authentication_string<>_binary'' from mysql.user where user=_binary'rpl_ignore_grant';
52
53 # clear what we have done, to not influence other tests.
54 connection master;
55 delete from mysql.user where user=_binary'rpl_ignore_grant';
56 delete from mysql.db where user=_binary'rpl_ignore_grant';
57 flush privileges;
58 save_master_pos;
59 connection slave;
60 sync_with_master;
61 delete from mysql.user where user=_binary'rpl_ignore_grant';
62 delete from mysql.db where user=_binary'rpl_ignore_grant';
63 flush privileges;
64
65 # End of 4.1 tests
66 --source include/rpl_end.inc