include/master-slave.inc Warnings: Note #### Sending passwords in plain text without SSL/TLS is extremely insecure. Note #### Storing MySQL user name or password information in the master info repository is not secure and is therefore not recommended. Please consider using the USER and PASSWORD connection options for START SLAVE; see the 'START SLAVE Syntax' in the MySQL Manual for more information. [connection master] include/rpl_use_privilege_db.inc [USE rpl_priv] SET @@session.sql_log_bin = OFF; CREATE TABLE t(c INT, d INT); SET @@session.sql_log_bin = ON; [connection slave] include/rpl_use_privilege_db.inc [USE rpl_priv] CALL mtr.add_suppression(".*command denied to user."); CALL mtr.add_suppression(".*the option binlog_row_value_options.*"); CALL mtr.add_suppression(".*The slave coordinator and worker threads are stopped.*"); CREATE TABLE t(c INT, d INT); # # Running test for # GRANT INSERT ON *.* TO ... # [connection master] INSERT INTO t VALUES(10, 10); include/save_master_pos.inc [connection slave] START SLAVE; include/wait_for_slave_sql_error.inc [errno=1142] STOP SLAVE; GRANT INSERT ON *.* TO 'a_bigger_username_just_for_test'; START SLAVE; include/sync_slave_sql.inc REVOKE INSERT ON *.* FROM 'a_bigger_username_just_for_test'; STOP SLAVE; include/diff_tables.inc [master:t, slave:t] # # Running test for # GRANT UPDATE ON *.* TO ... # [connection master] UPDATE t SET c = 12 WHERE c = 10; include/save_master_pos.inc [connection slave] START SLAVE; include/wait_for_slave_sql_error.inc [errno=1142] STOP SLAVE; GRANT UPDATE ON *.* TO 'a_bigger_username_just_for_test'; START SLAVE; include/sync_slave_sql.inc REVOKE UPDATE ON *.* FROM 'a_bigger_username_just_for_test'; STOP SLAVE; include/diff_tables.inc [master:t, slave:t] [connection slave] SET @binlog_row_value_options_save= @@GLOBAL.BINLOG_ROW_VALUE_OPTIONS; SET @@GLOBAL.BINLOG_ROW_VALUE_OPTIONS= PARTIAL_JSON; # # Running test for # GRANT UPDATE ON *.* TO ... # [connection master] UPDATE t SET c = 8 WHERE c = 12; include/save_master_pos.inc [connection slave] START SLAVE; include/wait_for_slave_sql_error.inc [errno=1142] STOP SLAVE; GRANT UPDATE ON *.* TO 'a_bigger_username_just_for_test'; START SLAVE; include/sync_slave_sql.inc REVOKE UPDATE ON *.* FROM 'a_bigger_username_just_for_test'; STOP SLAVE; SET @@GLOBAL.BINLOG_ROW_VALUE_OPTIONS= @binlog_row_value_options_save; include/diff_tables.inc [master:t, slave:t] # # Running test for # GRANT DELETE ON *.* TO ... # [connection master] DELETE FROM t WHERE c = 8; include/save_master_pos.inc [connection slave] START SLAVE; include/wait_for_slave_sql_error.inc [errno=1142] STOP SLAVE; GRANT DELETE ON *.* TO 'a_bigger_username_just_for_test'; START SLAVE; include/sync_slave_sql.inc REVOKE DELETE ON *.* FROM 'a_bigger_username_just_for_test'; STOP SLAVE; include/diff_tables.inc [master:t, slave:t] # # Running test for # GRANT INSERT ON rpl_priv.* TO ... # [connection master] INSERT INTO t VALUES(10, 10); include/save_master_pos.inc [connection slave] START SLAVE; include/wait_for_slave_sql_error.inc [errno=1142] STOP SLAVE; GRANT INSERT ON rpl_priv.* TO 'a_bigger_username_just_for_test'; START SLAVE; include/sync_slave_sql.inc REVOKE INSERT ON rpl_priv.* FROM 'a_bigger_username_just_for_test'; STOP SLAVE; include/diff_tables.inc [master:t, slave:t] # # Running test for # GRANT UPDATE ON rpl_priv.* TO ... # [connection master] UPDATE t SET c = 12 WHERE c = 10; include/save_master_pos.inc [connection slave] START SLAVE; include/wait_for_slave_sql_error.inc [errno=1142] STOP SLAVE; GRANT UPDATE ON rpl_priv.* TO 'a_bigger_username_just_for_test'; START SLAVE; include/sync_slave_sql.inc REVOKE UPDATE ON rpl_priv.* FROM 'a_bigger_username_just_for_test'; STOP SLAVE; include/diff_tables.inc [master:t, slave:t] [connection slave] SET @binlog_row_value_options_save= @@GLOBAL.BINLOG_ROW_VALUE_OPTIONS; SET @@GLOBAL.BINLOG_ROW_VALUE_OPTIONS= PARTIAL_JSON; # # Running test for # GRANT UPDATE ON rpl_priv.* TO ... # [connection master] UPDATE t SET c = 8 WHERE c = 12; include/save_master_pos.inc [connection slave] START SLAVE; include/wait_for_slave_sql_error.inc [errno=1142] STOP SLAVE; GRANT UPDATE ON rpl_priv.* TO 'a_bigger_username_just_for_test'; START SLAVE; include/sync_slave_sql.inc REVOKE UPDATE ON rpl_priv.* FROM 'a_bigger_username_just_for_test'; STOP SLAVE; SET @@GLOBAL.BINLOG_ROW_VALUE_OPTIONS= @binlog_row_value_options_save; include/diff_tables.inc [master:t, slave:t] # # Running test for # GRANT DELETE ON rpl_priv.* TO ... # [connection master] DELETE FROM t WHERE c = 8; include/save_master_pos.inc [connection slave] START SLAVE; include/wait_for_slave_sql_error.inc [errno=1142] STOP SLAVE; GRANT DELETE ON rpl_priv.* TO 'a_bigger_username_just_for_test'; START SLAVE; include/sync_slave_sql.inc REVOKE DELETE ON rpl_priv.* FROM 'a_bigger_username_just_for_test'; STOP SLAVE; include/diff_tables.inc [master:t, slave:t] # # Running test for # GRANT INSERT ON rpl_priv.t TO ... # [connection master] INSERT INTO t VALUES(10, 10); include/save_master_pos.inc [connection slave] START SLAVE; include/wait_for_slave_sql_error.inc [errno=1142] STOP SLAVE; GRANT INSERT ON rpl_priv.t TO 'a_bigger_username_just_for_test'; START SLAVE; include/sync_slave_sql.inc REVOKE INSERT ON rpl_priv.t FROM 'a_bigger_username_just_for_test'; STOP SLAVE; include/diff_tables.inc [master:t, slave:t] # # Running test for # GRANT UPDATE ON rpl_priv.t TO ... # [connection master] UPDATE t SET c = 12 WHERE c = 10; include/save_master_pos.inc [connection slave] START SLAVE; include/wait_for_slave_sql_error.inc [errno=1142] STOP SLAVE; GRANT UPDATE ON rpl_priv.t TO 'a_bigger_username_just_for_test'; START SLAVE; include/sync_slave_sql.inc REVOKE UPDATE ON rpl_priv.t FROM 'a_bigger_username_just_for_test'; STOP SLAVE; include/diff_tables.inc [master:t, slave:t] [connection slave] SET @binlog_row_value_options_save= @@GLOBAL.BINLOG_ROW_VALUE_OPTIONS; SET @@GLOBAL.BINLOG_ROW_VALUE_OPTIONS= PARTIAL_JSON; # # Running test for # GRANT UPDATE ON rpl_priv.t TO ... # [connection master] UPDATE t SET c = 8 WHERE c = 12; include/save_master_pos.inc [connection slave] START SLAVE; include/wait_for_slave_sql_error.inc [errno=1142] STOP SLAVE; GRANT UPDATE ON rpl_priv.t TO 'a_bigger_username_just_for_test'; START SLAVE; include/sync_slave_sql.inc REVOKE UPDATE ON rpl_priv.t FROM 'a_bigger_username_just_for_test'; STOP SLAVE; SET @@GLOBAL.BINLOG_ROW_VALUE_OPTIONS= @binlog_row_value_options_save; include/diff_tables.inc [master:t, slave:t] # # Running test for # GRANT DELETE ON rpl_priv.t TO ... # [connection master] DELETE FROM t WHERE c = 8; include/save_master_pos.inc [connection slave] START SLAVE; include/wait_for_slave_sql_error.inc [errno=1142] STOP SLAVE; GRANT DELETE ON rpl_priv.t TO 'a_bigger_username_just_for_test'; START SLAVE; include/sync_slave_sql.inc REVOKE DELETE ON rpl_priv.t FROM 'a_bigger_username_just_for_test'; STOP SLAVE; include/diff_tables.inc [master:t, slave:t] # # Running test for # GRANT INSERT(c, d) ON rpl_priv.t TO ... # [connection master] INSERT INTO t VALUES(10, 10); include/save_master_pos.inc [connection slave] START SLAVE; include/wait_for_slave_sql_error.inc [errno=1142] STOP SLAVE; GRANT INSERT(c, d) ON rpl_priv.t TO 'a_bigger_username_just_for_test'; START SLAVE; include/sync_slave_sql.inc REVOKE INSERT(c, d) ON rpl_priv.t FROM 'a_bigger_username_just_for_test'; STOP SLAVE; include/diff_tables.inc [master:t, slave:t] # # Running test for # GRANT UPDATE(c) ON rpl_priv.t TO ... # [connection master] UPDATE t SET c = 12 WHERE c = 10; include/save_master_pos.inc [connection slave] START SLAVE; include/wait_for_slave_sql_error.inc [errno=1142] STOP SLAVE; GRANT UPDATE(c) ON rpl_priv.t TO 'a_bigger_username_just_for_test'; START SLAVE; include/sync_slave_sql.inc REVOKE UPDATE(c) ON rpl_priv.t FROM 'a_bigger_username_just_for_test'; STOP SLAVE; include/diff_tables.inc [master:t, slave:t] DROP TABLE t; [connection master] DROP TABLE t; include/rpl_end.inc