1
# Works in statement-based and row-based binlogging.
2
# Test that GRANT and other user management commands are replicated to the slave
4
-- source include/master-slave.inc
6
# do not be influenced by other tests.
8
delete from mysql.user where user=_binary'rpl_do_grant';
9
delete from mysql.db where user=_binary'rpl_do_grant';
14
# if these DELETE did nothing on the master, we need to do them manually on the
16
delete from mysql.user where user=_binary'rpl_ignore_grant';
17
delete from mysql.db where user=_binary'rpl_ignore_grant';
20
# test replication of GRANT
22
grant select on *.* to rpl_do_grant@localhost;
23
grant drop on test.* to rpl_do_grant@localhost;
27
show grants for rpl_do_grant@localhost;
29
# test replication of SET PASSWORD
31
set password for rpl_do_grant@localhost=password("does it work?");
35
select password<>_binary'' from mysql.user where user=_binary'rpl_do_grant';
38
# Bug#24158 SET PASSWORD in binary log fails under ANSI_QUOTES
41
update mysql.user set password='' where user='rpl_do_grant';
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?');
50
select password<>'' from mysql.user where user='rpl_do_grant';
53
# clear what we have done, to not influence other tests.
55
delete from mysql.user where user=_binary'rpl_do_grant';
56
delete from mysql.db where user=_binary'rpl_do_grant';
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';
69
show grants for rpl_do_grant@localhost;
72
show grants for rpl_do_grant@localhost;
75
create user rpl_do_grant@localhost;
76
show grants for rpl_do_grant@localhost;
78
show grants for rpl_do_grant2@localhost;
79
sync_slave_with_master;
80
show grants for rpl_do_grant@localhost;
82
show grants for rpl_do_grant2@localhost;
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;
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;
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;
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;
109
drop user rpl_do_grant2@localhost;
111
show grants for rpl_do_grant2@localhost;
112
sync_slave_with_master;
114
show grants for rpl_do_grant2@localhost;