@@ -89,10 +89,91 @@ FROM_HOST FROM_USER TO_HOST TO_USER WITH_ADMIN_OPTION
89
89
[connection slave]
90
90
START SLAVE IO_THREAD;
91
91
include/wait_for_slave_io_to_start.inc
92
+
93
+ # Verify if 'DEFAULT ROLE' clause is bin-logged.
94
+
95
+ [connection master]
96
+ connection master;
97
+ CREATE USER u2@localhost DEFAULT ROLE r1, r2;
98
+ CREATE USER u3@localhost DEFAULT ROLE r1;
99
+
100
+ SHOW GRANTS FOR u2@localhost;
101
+ Grants for u2@localhost
102
+ GRANT USAGE ON *.* TO `u2`@`localhost`
103
+ GRANT `r1`@`%`,`r2`@`%` TO `u2`@`localhost`
104
+
105
+ SHOW GRANTS FOR u3@localhost;
106
+ Grants for u3@localhost
107
+ GRANT USAGE ON *.* TO `u3`@`localhost`
108
+ GRANT `r1`@`%` TO `u3`@`localhost`
109
+ include/sync_slave_sql_with_master.inc
110
+ connection master;
111
+ connection slave;
112
+ connection slave;
113
+ SHOW GRANTS FOR u2@localhost;
114
+ Grants for u2@localhost
115
+ GRANT USAGE ON *.* TO `u2`@`localhost`
116
+ GRANT `r1`@`%`,`r2`@`%` TO `u2`@`localhost`
117
+ SHOW GRANTS FOR u3@localhost;
118
+ Grants for u3@localhost
119
+ GRANT USAGE ON *.* TO `u3`@`localhost`
120
+ GRANT `r1`@`%` TO `u3`@`localhost`
121
+
122
+ SHOW CREATE USER u2@localhost;
123
+ CREATE USER for u2@localhost
124
+ CREATE USER 'u2'@'localhost' IDENTIFIED WITH 'caching_sha2_password' DEFAULT ROLE `r1`@`%`,`r2`@`%` REQUIRE NONE PASSWORD EXPIRE DEFAULT ACCOUNT UNLOCK PASSWORD HISTORY DEFAULT PASSWORD REUSE INTERVAL DEFAULT PASSWORD REQUIRE CURRENT DEFAULT
125
+ SHOW CREATE USER u3@localhost;
126
+ CREATE USER for u3@localhost
127
+ CREATE USER 'u3'@'localhost' IDENTIFIED WITH 'caching_sha2_password' DEFAULT ROLE `r1`@`%` REQUIRE NONE PASSWORD EXPIRE DEFAULT ACCOUNT UNLOCK PASSWORD HISTORY DEFAULT PASSWORD REUSE INTERVAL DEFAULT PASSWORD REQUIRE CURRENT DEFAULT
128
+ [connection master]
129
+ connection master;
130
+
131
+ ALTER USER u2@localhost DEFAULT ROLE NONE;
132
+ SHOW GRANTS FOR u3@localhost;
133
+ Grants for u3@localhost
134
+ GRANT USAGE ON *.* TO `u3`@`localhost`
135
+ GRANT `r1`@`%` TO `u3`@`localhost`
136
+ ALTER USER u2@localhost DEFAULT ROLE r1;
137
+ GRANT r2 TO u3@localhost;
138
+ ALTER USER u3@localhost DEFAULT ROLE ALL;
139
+ SHOW GRANTS FOR u3@localhost;
140
+ Grants for u3@localhost
141
+ GRANT USAGE ON *.* TO `u3`@`localhost`
142
+ GRANT `r1`@`%`,`r2`@`%` TO `u3`@`localhost`
143
+ ALTER USER u3@localhost DEFAULT ROLE r2;
144
+ SHOW GRANTS FOR u2@localhost;
145
+ Grants for u2@localhost
146
+ GRANT USAGE ON *.* TO `u2`@`localhost`
147
+ GRANT `r1`@`%`,`r2`@`%` TO `u2`@`localhost`
148
+ SHOW GRANTS FOR u3@localhost;
149
+ Grants for u3@localhost
150
+ GRANT USAGE ON *.* TO `u3`@`localhost`
151
+ GRANT `r1`@`%`,`r2`@`%` TO `u3`@`localhost`
152
+
153
+ include/sync_slave_sql_with_master.inc
154
+ connection master;
155
+ connection slave;
156
+ connection slave;
157
+ SHOW GRANTS FOR u2@localhost;
158
+ Grants for u2@localhost
159
+ GRANT USAGE ON *.* TO `u2`@`localhost`
160
+ GRANT `r1`@`%`,`r2`@`%` TO `u2`@`localhost`
161
+ SHOW GRANTS FOR u3@localhost;
162
+ Grants for u3@localhost
163
+ GRANT USAGE ON *.* TO `u3`@`localhost`
164
+ GRANT `r1`@`%`,`r2`@`%` TO `u3`@`localhost`
165
+
166
+ SHOW CREATE USER u2@localhost;
167
+ CREATE USER for u2@localhost
168
+ CREATE USER 'u2'@'localhost' IDENTIFIED WITH 'caching_sha2_password' DEFAULT ROLE `r1`@`%` REQUIRE NONE PASSWORD EXPIRE DEFAULT ACCOUNT UNLOCK PASSWORD HISTORY DEFAULT PASSWORD REUSE INTERVAL DEFAULT PASSWORD REQUIRE CURRENT DEFAULT
169
+ SHOW CREATE USER u3@localhost;
170
+ CREATE USER for u3@localhost
171
+ CREATE USER 'u3'@'localhost' IDENTIFIED WITH 'caching_sha2_password' DEFAULT ROLE `r2`@`%` REQUIRE NONE PASSWORD EXPIRE DEFAULT ACCOUNT UNLOCK PASSWORD HISTORY DEFAULT PASSWORD REUSE INTERVAL DEFAULT PASSWORD REQUIRE CURRENT DEFAULT
172
+
92
173
# Cleanup Statement
93
174
[connection master]
94
175
DROP ROLE r1, r2, r3,r4;
95
- DROP USER u1@localhost;
176
+ DROP USER u1@localhost, u2@localhost, u3@localhost ;
96
177
include/sync_slave_sql_with_master.inc
97
178
SELECT * FROM mysql.default_roles;
98
179
HOST USER DEFAULT_ROLE_HOST DEFAULT_ROLE_USER
@@ -115,8 +196,15 @@ slave-bin.000001 # Query # # use `test`; CREATE ROLE r4
115
196
slave-bin.000001 # Query # # use `test`; GRANT REPLICATION SLAVE ON *.* TO 'r4'@'%'
116
197
slave-bin.000001 # Query # # use `test`; GRANT r4 to u1@localhost
117
198
slave-bin.000001 # Query # # use `test`; ALTER USER u1@localhost DEFAULT ROLE ALL
199
+ slave-bin.000001 # Query # # use `test`; CREATE USER 'u2'@'localhost' IDENTIFIED WITH 'caching_sha2_password' DEFAULT ROLE `r1`@`%`,`r2`@`%`
200
+ slave-bin.000001 # Query # # use `test`; CREATE USER 'u3'@'localhost' IDENTIFIED WITH 'caching_sha2_password' DEFAULT ROLE `r1`@`%`
201
+ slave-bin.000001 # Query # # use `test`; ALTER USER u2@localhost DEFAULT ROLE NONE
202
+ slave-bin.000001 # Query # # use `test`; ALTER USER u2@localhost DEFAULT ROLE r1
203
+ slave-bin.000001 # Query # # use `test`; GRANT r2 TO u3@localhost
204
+ slave-bin.000001 # Query # # use `test`; ALTER USER u3@localhost DEFAULT ROLE ALL
205
+ slave-bin.000001 # Query # # use `test`; ALTER USER u3@localhost DEFAULT ROLE r2
118
206
slave-bin.000001 # Query # # use `test`; DROP ROLE r1, r2, r3,r4
119
- slave-bin.000001 # Query # # use `test`; DROP USER u1@localhost
207
+ slave-bin.000001 # Query # # use `test`; DROP USER u1@localhost, u2@localhost, u3@localhost
120
208
include/stop_slave.inc
121
209
CHANGE MASTER TO MASTER_USER='root';
122
210
Warnings:
0 commit comments