1include/master-slave.inc 2Warnings: 3Note #### Sending passwords in plain text without SSL/TLS is extremely insecure. 4Note #### 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. 5[connection master] 6create database d1; 7use d1; 8create table t (s1 int) engine=innodb; 9set @@autocommit=0; 10start transaction; 11insert into t values (1); 12set @orig_sql_mode= @@sql_mode; 13set sql_mode= (select replace(@@sql_mode,'NO_AUTO_CREATE_USER','')); 14Warnings: 15Warning 3090 Changing sql mode 'NO_AUTO_CREATE_USER' is deprecated. It will be removed in a future release. 16grant select on t to x@y; 17Warnings: 18Warning 1287 Using GRANT for creating new user is deprecated and will be removed in future release. Create new user with CREATE USER statement. 19set sql_mode= @orig_sql_mode; 20Warnings: 21Warning 3090 Changing sql mode 'NO_AUTO_CREATE_USER' is deprecated. It will be removed in a future release. 22rollback; 23show grants for x@y; 24Grants for x@y 25GRANT USAGE ON *.* TO 'x'@'y' 26GRANT SELECT ON `d1`.`t` TO 'x'@'y' 27start transaction; 28insert into t values (2); 29revoke select on t from x@y; 30commit; 31select * from t; 32s1 331 342 35show grants for x@y; 36Grants for x@y 37GRANT USAGE ON *.* TO 'x'@'y' 38drop user x@y; 39drop database d1; 40[connection master] 41CREATE USER foo@localhost IDENTIFIED WITH 'mysql_native_password'; 42CREATE USER bar@localhost IDENTIFIED WITH 'mysql_native_password'; 43GRANT PROXY ON foo@localhost TO bar@localhost; 44include/assert.inc [Assert that the query logged is indeed the GRANT PROXY one] 45SHOW GRANTS FOR bar@localhost; 46Grants for bar@localhost 47GRANT USAGE ON *.* TO 'bar'@'localhost' 48GRANT PROXY ON 'foo'@'localhost' TO 'bar'@'localhost' 49include/sync_slave_sql_with_master.inc 50[connection slave] 51SHOW GRANTS FOR bar@localhost; 52Grants for bar@localhost 53GRANT USAGE ON *.* TO 'bar'@'localhost' 54GRANT PROXY ON 'foo'@'localhost' TO 'bar'@'localhost' 55[connection master] 56DROP USER foo@localhost; 57DROP USER bar@localhost; 58include/sync_slave_sql_with_master.inc 59include/rpl_end.inc 60