File: binlog_grant.test

package info (click to toggle)
mysql-8.0 8.0.43-3
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 1,273,924 kB
  • sloc: cpp: 4,684,605; ansic: 412,450; pascal: 108,398; java: 83,641; perl: 30,221; cs: 27,067; sql: 26,594; sh: 24,181; python: 21,816; yacc: 17,169; php: 11,522; xml: 7,388; javascript: 7,076; makefile: 2,194; lex: 1,075; awk: 670; asm: 520; objc: 183; ruby: 97; lisp: 86
file content (106 lines) | stat: -rw-r--r-- 2,948 bytes parent folder | download
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106

# Test grants for various objects (especially variables) related to
# the binary log

source include/have_log_bin.inc;

connection default;
--disable_warnings
reset master;
--enable_warnings

set @saved_binlog_format = @@global.binlog_format;
create user mysqltest_1@localhost;
show grants for mysqltest_1@localhost;

connect (plain,localhost,mysqltest_1,,test);
connect (root,localhost,root,,test);

# Testing setting session SQL_LOG_BIN variable both as
# root and as plain user.

--echo **** Variable SQL_LOG_BIN ****

connection root;
--echo [root]
set session sql_log_bin = 1;

connection plain;
--echo [plain]
--error ER_SPECIFIC_ACCESS_DENIED_ERROR
set session sql_log_bin = 1;


# Testing setting both session and global BINLOG_FORMAT variable both
# as root and as plain user.

--echo **** Variable BINLOG_FORMAT ****

connection root;
--echo [root]
set global binlog_format = 'row';
set session binlog_format = 'row';

connection plain;
--echo [plain]
--error ER_SPECIFIC_ACCESS_DENIED_ERROR
set global binlog_format = 'row';
--error ER_SPECIFIC_ACCESS_DENIED_ERROR
set session binlog_format = 'row';

--echo **** Clean up ****
disconnect plain;
disconnect root;

connection default;
set global binlog_format = @saved_binlog_format;
drop user mysqltest_1@localhost;


# Testing if REPLICATION CLIENT privilege is enough to execute
# SHOW MASTER LOGS and SHOW BINARY.
CREATE USER 'mysqltest_1'@'localhost';
GRANT REPLICATION CLIENT ON *.* TO 'mysqltest_1'@'localhost';
--connect(rpl,localhost,mysqltest_1,,)

--connection rpl
# We are only interested if the following commands succeed and not on
# their output.
--disable_result_log
SHOW MASTER LOGS;
SHOW BINARY LOGS;
--enable_result_log

# clean up
--disconnect rpl
connection default;
DROP USER 'mysqltest_1'@'localhost';


--echo #
--echo # Bug #31869146: 'GRANT SELECT, GRANT OPTION ON *.* ' WOULD NOT WRITE
--echo #   THE PRIVILEGES TO BINLOG
--echo #

let $binlog_start= query_get_value(SHOW MASTER STATUS, Position, 1);
CREATE USER b31869146@localhost;
CREATE DATABASE b31869146_db;
CREATE TABLE b31869146_db.t1 (a INT);
GRANT SELECT,GRANT OPTION ON *.* TO b31869146@localhost AS 'root'@'localhost' WITH ROLE NONE;
GRANT SELECT,GRANT OPTION ON b31869146_db.* TO b31869146@localhost;
GRANT SELECT,GRANT OPTION ON b31869146_db.t1 TO b31869146@localhost;
GRANT SELECT (a),GRANT OPTION ON b31869146_db.t1 TO b31869146@localhost;
GRANT SELECT ON *.* TO b31869146@localhost WITH GRANT OPTION AS 'root'@'localhost' WITH ROLE NONE;
GRANT SELECT ON b31869146_db.* TO b31869146@localhost WITH GRANT OPTION;
GRANT SELECT ON b31869146_db.t1 TO b31869146@localhost WITH GRANT OPTION;
GRANT SELECT (a) ON b31869146_db.t1 TO b31869146@localhost WITH GRANT OPTION;

--echo # Success must contain SELECT for all of the GRANTS
--echo # Show binlog events
source include/show_binlog_events.inc;

--echo # cleanup
DROP USER b31869146@localhost;
DROP DATABASE b31869146_db;

--echo # End of 8.0 tests