Debian Codegraph @

mysql-test/suite/binlog/r/binlog_grant.result

raw
1 connection default;
2 reset master;
3 set @saved_binlog_format = @@global.binlog_format;
4 create user mysqltest_1@localhost;
5 GRANT SELECT on test.* to mysqltest_1@localhost;
6 show grants for mysqltest_1@localhost;
7 Grants for mysqltest_1@localhost
8 GRANT USAGE ON *.* TO `mysqltest_1`@`localhost`
9 GRANT SELECT ON `test`.* TO `mysqltest_1`@`localhost`
10 connect plain,localhost,mysqltest_1,,test;
11 connect root,localhost,root,,test;
12 **** Variable SQL_LOG_BIN ****
13 connection root;
14 [root]
15 set session sql_log_bin = 1;
16 connection plain;
17 [plain]
18 set session sql_log_bin = 1;
19 ERROR 42000: Access denied; you need (at least one of) the BINLOG ADMIN privilege(s) for this operation
20 **** Variable BINLOG_FORMAT ****
21 connection root;
22 [root]
23 set global binlog_format = row;
24 set session binlog_format = row;
25 connection plain;
26 [plain]
27 set global binlog_format = row;
28 ERROR 42000: Access denied; you need (at least one of) the BINLOG ADMIN privilege(s) for this operation
29 set session binlog_format = row;
30 ERROR 42000: Access denied; you need (at least one of) the BINLOG ADMIN privilege(s) for this operation
31 **** Clean up ****
32 disconnect plain;
33 disconnect root;
34 connection default;
35 set global binlog_format = @saved_binlog_format;
36 drop user mysqltest_1@localhost;
37 CREATE USER 'mysqltest_1'@'localhost';
38 GRANT REPLICATION CLIENT ON *.* TO 'mysqltest_1'@'localhost';
39 connect rpl,localhost,mysqltest_1,,"*NO-ONE*";
40 connection rpl;
41 SHOW MASTER LOGS;
42 SHOW BINARY LOGS;
43 SHOW BINLOG STATUS;
44 disconnect rpl;
45 connection default;
46 DROP USER 'mysqltest_1'@'localhost';
47 #
48 # End of 10.4 tests
49 #
50 #
51 # Start of 10.5 tests
52 #
53 #
54 # MDEV-21743 Split up SUPER privilege to smaller privileges
55 #
56 # Test that REPLICATION CLIENT is an alias for BINLOG MONITOR
57 CREATE USER user1@localhost;
58 GRANT REPLICATION CLIENT ON *.* TO user1@localhost;
59 SHOW GRANTS FOR user1@localhost;
60 Grants for user1@localhost
61 GRANT BINLOG MONITOR ON *.* TO `user1`@`localhost`
62 REVOKE REPLICATION CLIENT ON *.* FROM user1@localhost;
63 SHOW GRANTS FOR user1@localhost;
64 Grants for user1@localhost
65 GRANT USAGE ON *.* TO `user1`@`localhost`
66 DROP USER user1@localhost;
67 # Test if SHOW BINARY LOGS and SHOW BINGLOG STATUS are not allowed without REPLICATION CLIENT
68 CREATE USER user1@localhost;
69 GRANT ALL PRIVILEGES ON *.* TO user1@localhost;
70 REVOKE REPLICATION CLIENT ON *.* FROM user1@localhost;
71 connect user1,localhost,user1,,;
72 connection user1;
73 SHOW MASTER LOGS;
74 ERROR 42000: Access denied; you need (at least one of) the BINLOG MONITOR privilege(s) for this operation
75 SHOW BINARY LOGS;
76 ERROR 42000: Access denied; you need (at least one of) the BINLOG MONITOR privilege(s) for this operation
77 SHOW BINLOG STATUS;
78 ERROR 42000: Access denied; you need (at least one of) the BINLOG MONITOR privilege(s) for this operation
79 disconnect user1;
80 connection default;
81 DROP USER user1@localhost;
82 # Test if PURGE BINARY LOGS is not allowed without BINLOG ADMIN
83 CREATE USER user1@localhost;
84 GRANT ALL PRIVILEGES ON *.* TO user1@localhost;
85 REVOKE BINLOG ADMIN ON *.* FROM user1@localhost;
86 connect user1,localhost,user1,,;
87 connection user1;
88 PURGE BINARY LOGS BEFORE '2001-01-01 00:00:00';
89 ERROR 42000: Access denied; you need (at least one of) the BINLOG ADMIN privilege(s) for this operation
90 disconnect user1;
91 connection default;
92 DROP USER user1@localhost;
93 # Test if PURGE BINLOG is allowed with BINLOG ADMIN
94 CREATE USER user1@localhost;
95 GRANT BINLOG ADMIN ON *.* TO user1@localhost;
96 connect user1,localhost,user1,,"*NO-ONE*";
97 connection user1;
98 PURGE BINARY LOGS BEFORE '2001-01-01 00:00:00';
99 disconnect user1;
100 connection default;
101 DROP USER user1@localhost;
102 # Test if SHOW BINLOG EVENTS is not allowed without BINLOG MONITOR
103 CREATE USER user1@localhost;
104 GRANT ALL PRIVILEGES ON *.* TO user1@localhost;
105 REVOKE BINLOG MONITOR ON *.* FROM user1@localhost;
106 connect user1,localhost,user1,,;
107 connection user1;
108 SHOW BINLOG EVENTS;
109 ERROR 42000: Access denied; you need (at least one of) the BINLOG MONITOR privilege(s) for this operation
110 disconnect user1;
111 connection default;
112 DROP USER user1@localhost;
113 # Test if SHOW BINLOG EVENTS is allowed with BINLOG MONITOR
114 CREATE USER user1@localhost;
115 GRANT BINLOG MONITOR ON *.* TO user1@localhost;
116 connect user1,localhost,user1,,"*NO-ONE*";
117 connection user1;
118 SHOW BINLOG EVENTS;
119 disconnect user1;
120 connection default;
121 DROP USER user1@localhost;
122 #
123 # MDEV-21975 Add BINLOG REPLAY privilege and bind new privileges to
124 # gtid_seq_no, preudo_thread_id, server_id, gtid_domain_id
125 #
126 # Test combinations of BINLOG REPLAY guarded features which typically
127 # arise in mysqlbinlog output replay on server.
128 #
129 CREATE USER user1@localhost;
130 GRANT BINLOG REPLAY ON *.* TO user1@localhost;
131 GRANT ALL ON test.* TO user1@localhost;
132 RESET MASTER;
133 CREATE TABLE t1 (a INT);
134 INSERT INTO t1 VALUES (1),(2),(3);
135 connect user1,localhost,user1,,;
136 RENAME TABLE t1 to t2;
137 connection default;
138 REVOKE BINLOG REPLAY ON *.* FROM user1@localhost;
139 call mtr.add_suppression("Access denied; you need (at least one of) the BINLOG REPLAY privilege(s) for this operation");
140 # Privilege errors are expected now:
141 connection user1;
142 connection default;
143 include/diff_tables.inc [t1,t2]
144 # Test cleanup
145 DROP TABLE t2,t1;
146 DROP USER user1@localhost;
147 #
148 # End of 10.5 test
149 #