1test_sequence
2------ grant/revoke/drop affects a parallel session test ------
3show grants for second_user@localhost ;
4ERROR 42000: There is no such grant defined for user 'second_user' on host 'localhost'
5create database mysqltest;
6use mysqltest;
7use test;
8grant usage on mysqltest.* to second_user@localhost
9identified by 'looser' ;
10grant select on mysqltest.t9 to second_user@localhost
11identified by 'looser' ;
12show grants for second_user@localhost ;
13Grants for second_user@localhost
14GRANT USAGE ON *.* TO 'second_user'@'localhost' IDENTIFIED BY PASSWORD '*13843FE600B19A81E32AF50D4A6FED25875FF1F3'
15GRANT SELECT ON `mysqltest`.`t9` TO 'second_user'@'localhost'
16select current_user();
17current_user()
18second_user@localhost
19show grants for current_user();
20Grants for second_user@localhost
21GRANT USAGE ON *.* TO 'second_user'@'localhost' IDENTIFIED BY PASSWORD <secret>
22GRANT SELECT ON `mysqltest`.`t9` TO 'second_user'@'localhost'
23prepare s_t9 from 'select c1 as my_col
24                                 from t9 where c1= 1' ;
25execute s_t9 ;
26my_col
271
28select a as my_col from t1;
29ERROR 42000: SELECT command denied to user 'second_user'@'localhost' for table 't1'
30grant select on mysqltest.t1 to second_user@localhost
31identified by 'looser' ;
32show grants for second_user@localhost ;
33Grants for second_user@localhost
34GRANT USAGE ON *.* TO 'second_user'@'localhost' IDENTIFIED BY PASSWORD '*13843FE600B19A81E32AF50D4A6FED25875FF1F3'
35GRANT SELECT ON `mysqltest`.`t9` TO 'second_user'@'localhost'
36GRANT SELECT ON `mysqltest`.`t1` TO 'second_user'@'localhost'
37drop table mysqltest.t9 ;
38show grants for second_user@localhost ;
39Grants for second_user@localhost
40GRANT USAGE ON *.* TO 'second_user'@'localhost' IDENTIFIED BY PASSWORD '*13843FE600B19A81E32AF50D4A6FED25875FF1F3'
41GRANT SELECT ON `mysqltest`.`t9` TO 'second_user'@'localhost'
42GRANT SELECT ON `mysqltest`.`t1` TO 'second_user'@'localhost'
43show grants for second_user@localhost ;
44Grants for second_user@localhost
45GRANT USAGE ON *.* TO 'second_user'@'localhost' IDENTIFIED BY PASSWORD <secret>
46GRANT SELECT ON `mysqltest`.`t9` TO 'second_user'@'localhost'
47GRANT SELECT ON `mysqltest`.`t1` TO 'second_user'@'localhost'
48prepare s_t1 from 'select a as my_col from t1' ;
49execute s_t1 ;
50my_col
511
522
533
544
55execute s_t9 ;
56ERROR 42S02: Table 'mysqltest.t9' doesn't exist
57deallocate prepare s_t9;
58revoke all privileges on mysqltest.t1 from second_user@localhost;
59show grants for second_user@localhost ;
60Grants for second_user@localhost
61GRANT USAGE ON *.* TO 'second_user'@'localhost' IDENTIFIED BY PASSWORD '*13843FE600B19A81E32AF50D4A6FED25875FF1F3'
62GRANT SELECT ON `mysqltest`.`t9` TO 'second_user'@'localhost'
63show grants for second_user@localhost ;
64Grants for second_user@localhost
65GRANT USAGE ON *.* TO 'second_user'@'localhost' IDENTIFIED BY PASSWORD <secret>
66GRANT SELECT ON `mysqltest`.`t9` TO 'second_user'@'localhost'
67execute s_t1 ;
68ERROR 42000: SELECT command denied to user 'second_user'@'localhost' for table 't1'
69revoke all privileges, grant option from second_user@localhost ;
70show grants for second_user@localhost ;
71Grants for second_user@localhost
72GRANT USAGE ON *.* TO 'second_user'@'localhost' IDENTIFIED BY PASSWORD '*13843FE600B19A81E32AF50D4A6FED25875FF1F3'
73drop user second_user@localhost ;
74commit ;
75show grants for second_user@localhost ;
76ERROR 42000: There is no such grant defined for user 'second_user' on host 'localhost'
77drop database mysqltest;
78prepare stmt3 from ' grant all on test.t1 to drop_user@localhost
79identified by ''looser'' ';
80grant all on test.t1 to drop_user@localhost
81identified by 'looser' ;
82prepare stmt3 from ' revoke all privileges on test.t1 from
83drop_user@localhost ';
84revoke all privileges on test.t1 from drop_user@localhost ;
85prepare stmt3 from ' drop user drop_user@localhost ';
86drop user drop_user@localhost;
87