|
| 1 | +SET @@SQL_MODE = REPLACE(@@SQL_MODE, 'NO_AUTO_CREATE_USER', ''); |
| 2 | +create database mysqltest_1; |
| 3 | +use mysqltest_1; |
| 4 | +grant all on mysqltest_1.* to 'normal'@'%'; |
| 5 | +grant select on mysqltest_1.* to 'read_only'@'%'; |
| 6 | +grant select,insert on mysqltest_1.* to 'read_write'@'%'; |
| 7 | +grant select,insert,alter on mysqltest_1.* to 'alter'@'%'; |
| 8 | +grant alter on mysqltest_1.* to only_alter@'%'; |
| 9 | +connect normal,localhost,normal,,mysqltest_1; |
| 10 | +connect read_only,localhost,read_only,,mysqltest_1; |
| 11 | +connect read_write,localhost,read_write,,mysqltest_1; |
| 12 | +connect alter,localhost,alter,,mysqltest_1; |
| 13 | +connect only_alter, localhost, only_alter,,mysqltest_1; |
| 14 | +connection normal; |
| 15 | +create sequence s1; |
| 16 | +select next value for s1; |
| 17 | +next value for s1 |
| 18 | +1 |
| 19 | +alter sequence s1 restart= 11; |
| 20 | +select * from s1; |
| 21 | +next_not_cached_value minimum_value maximum_value start_value increment cache_size cycle_option cycle_count |
| 22 | +11 1 9223372036854775806 1 1 1000 0 0 |
| 23 | +connection read_only; |
| 24 | +select next value for s1; |
| 25 | +ERROR 42000: INSERT command denied to user 'read_only'@'localhost' for table 's1' |
| 26 | +alter sequence s1 restart= 11; |
| 27 | +ERROR 42000: ALTER command denied to user 'read_only'@'localhost' for table 's1' |
| 28 | +select * from s1; |
| 29 | +next_not_cached_value minimum_value maximum_value start_value increment cache_size cycle_option cycle_count |
| 30 | +11 1 9223372036854775806 1 1 1000 0 0 |
| 31 | +connection read_write; |
| 32 | +select next value for s1; |
| 33 | +next value for s1 |
| 34 | +11 |
| 35 | +alter sequence s1 restart= 11; |
| 36 | +ERROR 42000: ALTER command denied to user 'read_write'@'localhost' for table 's1' |
| 37 | +select * from s1; |
| 38 | +next_not_cached_value minimum_value maximum_value start_value increment cache_size cycle_option cycle_count |
| 39 | +1011 1 9223372036854775806 1 1 1000 0 0 |
| 40 | +connection alter; |
| 41 | +select next value for s1; |
| 42 | +next value for s1 |
| 43 | +12 |
| 44 | +alter sequence s1 restart= 11; |
| 45 | +select * from s1; |
| 46 | +next_not_cached_value minimum_value maximum_value start_value increment cache_size cycle_option cycle_count |
| 47 | +11 1 9223372036854775806 1 1 1000 0 0 |
| 48 | +connection only_alter; |
| 49 | +select next value for s1; |
| 50 | +ERROR 42000: INSERT command denied to user 'only_alter'@'localhost' for table 's1' |
| 51 | +alter sequence s1 restart= 11; |
| 52 | +select * from s1; |
| 53 | +ERROR 42000: SELECT command denied to user 'only_alter'@'localhost' for table 's1' |
| 54 | +connection default; |
| 55 | +drop database mysqltest_1; |
| 56 | +drop user 'normal'@'%'; |
| 57 | +drop user 'read_only'@'%'; |
| 58 | +drop user 'read_write'@'%'; |
| 59 | +drop user 'alter'@'%'; |
| 60 | +drop user 'only_alter'@'%'; |
0 commit comments