include/rpl_init.inc [topology=1->3] Warnings: Note #### Sending passwords in plain text without SSL/TLS is extremely insecure. Note #### Storing MySQL user name or password information in the connection metadata repository is not secure and is therefore not recommended. Please consider using the USER and PASSWORD connection options for START REPLICA; see the 'START REPLICA Syntax' in the MySQL Manual for more information. [Server A] CREATE DATABASE auth_test_db; USE auth_test_db; CREATE TABLE t1 (pk INT PRIMARY KEY, a INT) engine = ndb; Test 1: [Server A] CREATE USER 'ndb_u1'@'localhost' IDENTIFIED by 'pass1'; GRANT SELECT ON t1 TO 'ndb_u1'@'localhost'; GRANT NDB_STORED_USER ON *.* to 'ndb_u1'@'localhost'; INSERT INTO t1 VALUES(1,1); [Connected to server C as ndb_u1] SELECT * FROM t1 ORDER BY pk; pk a 1 1 [Connected to server D as ndb_u1] SELECT * FROM t1 ORDER BY pk; pk a 1 1 [Test 1C: Server C binlog events] ** Expect log_replica_updates=0, and no binlog events SHOW VARIABLES LIKE 'log_replica_updates'; Variable_name Value log_replica_updates OFF include/show_binlog_events.inc Log_name Pos Event_type Server_id End_log_pos Info [Test 1D: Server D binlog events] ** Expect 4 Query events: 1 CREATE USER + 3 GRANTs. ** These must have server_id = 1. include/show_binlog_events.inc Log_name Pos Event_type Server_id End_log_pos Info # # Query 1 # CREATE USER 'ndb_u1'@'localhost' IDENTIFIED WITH 'caching_sha2_password' AS '' REQUIRE NONE PASSWORD EXPIRE DEFAULT ACCOUNT UNLOCK PASSWORD HISTORY DEFAULT PASSWORD REUSE INTERVAL DEFAULT PASSWORD REQUIRE CURRENT DEFAULT # # Query 1 # GRANT USAGE ON *.* TO 'ndb_u1'@'localhost' # # Query 1 # GRANT NDB_STORED_USER ON *.* TO 'ndb_u1'@'localhost' # # Query 1 # GRANT SELECT ON `auth_test_db`.`t1` TO 'ndb_u1'@'localhost' Test 2: [Server B] CREATE USER 'ndb_u2'@'localhost' IDENTIFIED by 'pass2'; GRANT NDB_STORED_USER ON *.* to 'ndb_u2'@'localhost'; GRANT SELECT ON t1 TO 'ndb_u2'@'localhost'; INSERT INTO t1 VALUES(2,2); [Connected to Server A as ndb_u2] SELECT * FROM t1 ORDER BY pk; pk a 1 1 2 2 [Connected to Server C as ndb_u2] SELECT * FROM t1 ORDER BY pk; pk a 1 1 2 2 [Connected to Server D as ndb_u2] SELECT * FROM t1 ORDER BY pk; pk a 1 1 2 2 Test 3: [Server A] CREATE USER 'local_user_1'@'localhost' IDENTIFIED BY 'local1'; [Connected to Server C as local_user_1] [Server D] SHOW CREATE USER local_user_1@localhost; ERROR HY000: Operation SHOW CREATE USER failed for 'local_user_1'@'localhost' Test 4: [Server B] CREATE USER local_user_2@b; [Server A] [Server C] SHOW CREATE USER local_user_2@b; ERROR HY000: Operation SHOW CREATE USER failed for 'local_user_2'@'b' Test 5: [Server A] SET sql_log_bin=0; CREATE USER 'ndb_u5'@'localhost' IDENTIFIED by 'pass5'; GRANT NDB_STORED_USER ON *.* to 'ndb_u5'@'localhost'; GRANT SELECT ON t1 TO 'ndb_u5'@'localhost'; INSERT INTO t1 VALUES(3,3); SET sql_log_bin=1; ERROR 28000: Access denied for user 'ndb_u5'@'localhost' (using password: YES) Test 6: [Server B] SET sql_log_bin=0; CREATE USER 'ndb_u6'@'localhost' IDENTIFIED by 'pass6'; GRANT NDB_STORED_USER ON *.* to 'ndb_u6'@'localhost'; GRANT SELECT ON t1 TO 'ndb_u6'@'localhost'; INSERT INTO t1 VALUES(4,4); SET sql_log_bin=1; ERROR 28000: Access denied for user 'ndb_u6'@'localhost' (using password: YES) Test 7: [Server A] Creating user u7 with random password GRANT SELECT ON t1 TO 'u7'@'127.%'; [Server C] select current_user(), @@server_id; current_user() @@server_id u7@127.% 3 [Server A] GRANT ndb_stored_user on *.* to u7@'127.%'; select current_user(), @@server_id; current_user() @@server_id root@localhost 1 [Server B] select current_user(), @@server_id; current_user() @@server_id u7@127.% 2 Cleanup: SET sql_log_bin=1; drop user local_user_1@localhost; drop user ndb_u1@localhost; drop user ndb_u2@localhost; drop user if exists ndb_u5@localhost; drop user if exists ndb_u6@localhost; drop user if exists u7@'127.%'; drop table t1; drop database auth_test_db; drop user local_user_2@b; FLUSH BINARY LOGS; include/rpl_end.inc