summaryrefslogtreecommitdiff
path: root/mysql-test/suite/rpl/t/rpl_ignore_grant.test
blob: ee049a515d7be3aed13acec1c55cebd37f712965 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
# Test that GRANT is not replicated to the slave
# when --replicate-wild-ignore-table=mysql.%
# In BUG#980, this test would _randomly_ fail.

source include/master-slave.inc;

# do not be influenced by other tests.
connection master;
set global sql_mode="";
set local sql_mode="";
delete from mysql.user where user=_binary'rpl_ignore_grant';
delete from mysql.db where user=_binary'rpl_ignore_grant';
flush privileges;
save_master_pos;
connection slave;
set global sql_mode="";
set local sql_mode="";
sync_with_master;
# as these DELETE were not replicated, we need to do them manually on the
# slave.
delete from mysql.user where user=_binary'rpl_ignore_grant';
delete from mysql.db where user=_binary'rpl_ignore_grant';
flush privileges;

# test non-replication of GRANT
connection master;
grant select on *.* to rpl_ignore_grant@localhost;
grant drop on test.* to rpl_ignore_grant@localhost;
show grants for rpl_ignore_grant@localhost;
save_master_pos;
connection slave;
sync_with_master;
--error 1141 #("no such grant for user")
show grants for rpl_ignore_grant@localhost;
# check it another way
select count(*) from mysql.user where user=_binary'rpl_ignore_grant';
select count(*) from mysql.db where user=_binary'rpl_ignore_grant';

# test non-replication of SET PASSWORD
# first force creation of the user on slave (because as the user does not exist
# on slave, the SET PASSWORD may be replicated but silently do nothing; this is
# not what we want; we want it to be not-replicated).
grant select on *.* to rpl_ignore_grant@localhost;
connection master;
set password for rpl_ignore_grant@localhost=password("does it work?");
save_master_pos;
connection slave;
sync_with_master;
select password<>_binary'' from mysql.user where user=_binary'rpl_ignore_grant';

# clear what we have done, to not influence other tests.
connection master;
delete from mysql.user where user=_binary'rpl_ignore_grant';
delete from mysql.db where user=_binary'rpl_ignore_grant';
flush privileges;
save_master_pos;
connection slave;
sync_with_master;
delete from mysql.user where user=_binary'rpl_ignore_grant';
delete from mysql.db where user=_binary'rpl_ignore_grant';
flush privileges;

set global sql_mode=default;
connection master;
set global sql_mode=default;
# End of 4.1 tests
--source include/rpl_end.inc