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';
37
# clear what we have done, to not influence other tests.
39
delete from mysql.user where user=_binary'rpl_do_grant';
40
delete from mysql.db where user=_binary'rpl_do_grant';
42
sync_slave_with_master;
43
# The mysql database is not replicated, so we have to do the deletes
44
# manually on the slave as well.
45
delete from mysql.user where user=_binary'rpl_do_grant';
46
delete from mysql.db where user=_binary'rpl_do_grant';
53
show grants for rpl_do_grant@localhost;
56
show grants for rpl_do_grant@localhost;
59
create user rpl_do_grant@localhost;
60
show grants for rpl_do_grant@localhost;
62
show grants for rpl_do_grant2@localhost;
63
sync_slave_with_master;
64
show grants for rpl_do_grant@localhost;
66
show grants for rpl_do_grant2@localhost;
69
rename user rpl_do_grant@localhost to rpl_do_grant2@localhost;
70
show grants for rpl_do_grant2@localhost;
71
sync_slave_with_master;
72
show grants for rpl_do_grant2@localhost;
75
grant DELETE,INSERT on mysqltest1.* to rpl_do_grant2@localhost;
76
show grants for rpl_do_grant2@localhost;
77
sync_slave_with_master;
78
show grants for rpl_do_grant2@localhost;
81
revoke DELETE on mysqltest1.* from rpl_do_grant2@localhost;
82
show grants for rpl_do_grant2@localhost;
83
sync_slave_with_master;
84
show grants for rpl_do_grant2@localhost;
87
revoke all privileges, grant option from rpl_do_grant2@localhost;
88
show grants for rpl_do_grant2@localhost;
89
sync_slave_with_master;
90
show grants for rpl_do_grant2@localhost;
93
drop user rpl_do_grant2@localhost;
95
show grants for rpl_do_grant2@localhost;
96
sync_slave_with_master;
98
show grants for rpl_do_grant2@localhost;