~drizzle-trunk/drizzle/development

1 by brian
clean slate
1
# Works in statement-based and row-based binlogging.
2
# Test that GRANT and other user management commands are replicated to the slave
3
4
-- source include/master-slave.inc
5
6
# do not be influenced by other tests.
7
connection master;
8
delete from mysql.user where user=_binary'rpl_do_grant';
9
delete from mysql.db where user=_binary'rpl_do_grant';
10
flush privileges;
11
save_master_pos;
12
connection slave;
13
sync_with_master;
14
# if these DELETE did nothing on the master, we need to do them manually on the
15
# slave.
16
delete from mysql.user where user=_binary'rpl_ignore_grant';
17
delete from mysql.db where user=_binary'rpl_ignore_grant';
18
flush privileges;
19
20
# test replication of GRANT
21
connection master;
22
grant select on *.* to rpl_do_grant@localhost;
23
grant drop on test.* to rpl_do_grant@localhost;
24
save_master_pos;
25
connection slave;
26
sync_with_master;
27
show grants for rpl_do_grant@localhost;
28
29
# test replication of SET PASSWORD
30
connection master;
31
set password for rpl_do_grant@localhost=password("does it work?");
32
save_master_pos;
33
connection slave;
34
sync_with_master;
35
select password<>_binary'' from mysql.user where user=_binary'rpl_do_grant';
36
37
#
38
# Bug#24158 SET PASSWORD in binary log fails under ANSI_QUOTES
39
#
40
connection master;
41
update mysql.user set password='' where user='rpl_do_grant';
42
flush privileges;
43
select password<>'' from mysql.user where user='rpl_do_grant';
44
set sql_mode='ANSI_QUOTES';
45
set password for rpl_do_grant@localhost=password('does it work?');
46
set sql_mode='';
47
save_master_pos;
48
connection slave;
49
sync_with_master;
50
select password<>'' from mysql.user where user='rpl_do_grant';
51
52
53
# clear what we have done, to not influence other tests.
54
connection master;
55
delete from mysql.user where user=_binary'rpl_do_grant';
56
delete from mysql.db where user=_binary'rpl_do_grant';
57
flush privileges;
58
sync_slave_with_master;
59
# The mysql database is not replicated, so we have to do the deletes
60
# manually on the slave as well. 
61
delete from mysql.user where user=_binary'rpl_do_grant';
62
delete from mysql.db where user=_binary'rpl_do_grant';
63
flush privileges;
64
65
# End of 4.1 tests
66
67
connection master;
68
--error 1141
69
show grants for rpl_do_grant@localhost;
70
connection slave;
71
--error 1141
72
show grants for rpl_do_grant@localhost;
73
74
connection master;
75
create user rpl_do_grant@localhost;
76
show grants for rpl_do_grant@localhost;
77
--error 1141
78
show grants for rpl_do_grant2@localhost;
79
sync_slave_with_master;
80
show grants for rpl_do_grant@localhost;
81
--error 1141
82
show grants for rpl_do_grant2@localhost;
83
84
connection master;
85
rename user rpl_do_grant@localhost to rpl_do_grant2@localhost;
86
show grants for rpl_do_grant2@localhost;
87
sync_slave_with_master;
88
show grants for rpl_do_grant2@localhost;
89
90
connection master;
91
grant DELETE,INSERT on mysqltest1.* to rpl_do_grant2@localhost;
92
show grants for rpl_do_grant2@localhost;
93
sync_slave_with_master;
94
show grants for rpl_do_grant2@localhost;
95
96
connection master;
97
revoke DELETE on mysqltest1.* from rpl_do_grant2@localhost;
98
show grants for rpl_do_grant2@localhost;
99
sync_slave_with_master;
100
show grants for rpl_do_grant2@localhost;
101
102
connection master;
103
revoke all privileges, grant option from rpl_do_grant2@localhost;
104
show grants for rpl_do_grant2@localhost;
105
sync_slave_with_master;
106
show grants for rpl_do_grant2@localhost;
107
108
connection master;
109
drop user rpl_do_grant2@localhost;
110
--error 1141
111
show grants for rpl_do_grant2@localhost;
112
sync_slave_with_master;
113
--error 1141
114
show grants for rpl_do_grant2@localhost;