| 1 |
include/master-slave.inc |
| 2 |
[connection master] |
| 3 |
connection master; |
| 4 |
CREATE USER dummy@localhost; |
| 5 |
CREATE USER dummy1@localhost, dummy2@localhost; |
| 6 |
SELECT user, host FROM mysql.user WHERE user like 'dummy%'; |
| 7 |
User Host |
| 8 |
dummy localhost |
| 9 |
dummy1 localhost |
| 10 |
dummy2 localhost |
| 11 |
SELECT COUNT(*) FROM mysql.user WHERE user like 'dummy%'; |
| 12 |
COUNT(*) |
| 13 |
3 |
| 14 |
connection slave; |
| 15 |
**** On Slave **** |
| 16 |
SELECT user,host FROM mysql.user WHERE user like 'dummy%'; |
| 17 |
User Host |
| 18 |
dummy localhost |
| 19 |
dummy1 localhost |
| 20 |
dummy2 localhost |
| 21 |
SELECT COUNT(*) FROM mysql.user WHERE user like 'dummy%'; |
| 22 |
COUNT(*) |
| 23 |
3 |
| 24 |
connection master; |
| 25 |
DROP USER nonexisting@localhost; |
| 26 |
ERROR HY000: Operation DROP USER failed for 'nonexisting'@'localhost' |
| 27 |
DROP USER nonexisting@localhost, dummy@localhost; |
| 28 |
ERROR HY000: Operation DROP USER failed for 'nonexisting'@'localhost' |
| 29 |
DROP USER dummy1@localhost, dummy2@localhost; |
| 30 |
SELECT user, host FROM mysql.user WHERE user like 'dummy%'; |
| 31 |
User Host |
| 32 |
SELECT COUNT(*) FROM mysql.user WHERE user like 'dummy%'; |
| 33 |
COUNT(*) |
| 34 |
0 |
| 35 |
connection slave; |
| 36 |
SELECT user,host FROM mysql.user WHERE user like 'dummy%'; |
| 37 |
User Host |
| 38 |
SELECT COUNT(*) FROM mysql.user WHERE user like 'dummy%'; |
| 39 |
COUNT(*) |
| 40 |
0 |
| 41 |
# |
| 42 |
# MDEV-38506: Failed GRANT on a procedure breaks replication |
| 43 |
# |
| 44 |
# Disable NO_AUTO_CREATE_USER so grant will auto-create users |
| 45 |
connection master; |
| 46 |
SET @old_sql_mode= @@GLOBAL.sql_mode; |
| 47 |
SET GLOBAL sql_mode=''; |
| 48 |
# Create new stored procedure for GRANT EXECUTE ON PROCEDURE |
| 49 |
CREATE PROCEDURE test.sp() SELECT 1; |
| 50 |
# Create a new user with limited privileges to grant sp execution |
| 51 |
CREATE USER 'test_user'@'%' IDENTIFIED BY 'somepass'; |
| 52 |
GRANT EXECUTE ON test.* TO 'test_user'@'%' WITH GRANT OPTION; |
| 53 |
connect con_test_user,localhost,test_user,somepass; |
| 54 |
GRANT EXECUTE ON PROCEDURE test.sp TO 'nonexistentuser'@''; |
| 55 |
ERROR 42000: You are not allowed to create a user with GRANT |
| 56 |
# Ensuring the failed GRANT is not replicated.. |
| 57 |
include/rpl_sync.inc |
| 58 |
connection master; |
| 59 |
connection slave; |
| 60 |
SHOW GRANTS for 'nonexistentuser'@''; |
| 61 |
ERROR 42000: There is no such grant defined for user 'nonexistentuser' on host '%' |
| 62 |
# ..PASS |
| 63 |
connection master; |
| 64 |
disconnect con_test_user; |
| 65 |
SET GLOBAL sql_mode= @old_sql_mode; |
| 66 |
DROP USER test_user@'%'; |
| 67 |
DROP PROCEDURE test.sp; |
| 68 |
# End of MDEV-38506 test case |
| 69 |
include/rpl_end.inc |
| 70 |
# End of rpl_grant.test |