| 1 |
select * from performance_schema.setup_actors; |
| 2 |
HOST USER ROLE ENABLED HISTORY |
| 3 |
% % % YES YES |
| 4 |
truncate table performance_schema.setup_actors; |
| 5 |
insert into performance_schema.setup_actors |
| 6 |
values ('localhost', 'user1', '%', 'YES', 'YES'); |
| 7 |
insert into performance_schema.setup_actors |
| 8 |
values ('localhost', 'user2', '%', 'NO', 'NO'); |
| 9 |
create user user1@localhost, user2@localhost; |
| 10 |
grant ALL on *.* to user1@localhost; |
| 11 |
grant ALL on *.* to user2@localhost; |
| 12 |
flush privileges; |
| 13 |
# Switch to (con1, localhost, user1, , ) |
| 14 |
select NAME, TYPE, INSTRUMENTED, PROCESSLIST_USER, PROCESSLIST_HOST |
| 15 |
from performance_schema.threads |
| 16 |
where PROCESSLIST_ID = connection_id(); |
| 17 |
NAME TYPE INSTRUMENTED PROCESSLIST_USER PROCESSLIST_HOST |
| 18 |
thread/sql/one_connection FOREGROUND YES user1 localhost |
| 19 |
# Switch to (con2, localhost, user2, , ) |
| 20 |
select NAME, TYPE, INSTRUMENTED, PROCESSLIST_USER, PROCESSLIST_HOST |
| 21 |
from performance_schema.threads |
| 22 |
where PROCESSLIST_ID = connection_id(); |
| 23 |
NAME TYPE INSTRUMENTED PROCESSLIST_USER PROCESSLIST_HOST |
| 24 |
thread/sql/one_connection FOREGROUND NO user2 localhost |
| 25 |
# Switch to connection default |
| 26 |
update performance_schema.setup_actors set ENABLED='NO' where USER='user1'; |
| 27 |
update performance_schema.setup_actors set ENABLED='YES' where USER='user2'; |
| 28 |
# Switch to connection con1 |
| 29 |
select NAME, TYPE, INSTRUMENTED, PROCESSLIST_USER, PROCESSLIST_HOST |
| 30 |
from performance_schema.threads |
| 31 |
where PROCESSLIST_ID = connection_id(); |
| 32 |
NAME TYPE INSTRUMENTED PROCESSLIST_USER PROCESSLIST_HOST |
| 33 |
thread/sql/one_connection FOREGROUND YES user1 localhost |
| 34 |
# Switch to connection con2 |
| 35 |
select NAME, TYPE, INSTRUMENTED, PROCESSLIST_USER, PROCESSLIST_HOST |
| 36 |
from performance_schema.threads |
| 37 |
where PROCESSLIST_ID = connection_id(); |
| 38 |
NAME TYPE INSTRUMENTED PROCESSLIST_USER PROCESSLIST_HOST |
| 39 |
thread/sql/one_connection FOREGROUND NO user2 localhost |
| 40 |
# Disconnect con1 and con2 |
| 41 |
# Switch to (con1, localhost, user1, , ) |
| 42 |
select NAME, TYPE, INSTRUMENTED, PROCESSLIST_USER, PROCESSLIST_HOST |
| 43 |
from performance_schema.threads |
| 44 |
where PROCESSLIST_ID = connection_id(); |
| 45 |
NAME TYPE INSTRUMENTED PROCESSLIST_USER PROCESSLIST_HOST |
| 46 |
thread/sql/one_connection FOREGROUND NO user1 localhost |
| 47 |
# Switch to (con2 localhost, user2, , ) |
| 48 |
select NAME, TYPE, INSTRUMENTED, PROCESSLIST_USER, PROCESSLIST_HOST |
| 49 |
from performance_schema.threads |
| 50 |
where PROCESSLIST_ID = connection_id(); |
| 51 |
NAME TYPE INSTRUMENTED PROCESSLIST_USER PROCESSLIST_HOST |
| 52 |
thread/sql/one_connection FOREGROUND YES user2 localhost |
| 53 |
# Disconnect con1 and con2 |
| 54 |
# Switch to connection default |
| 55 |
revoke update on *.* from 'user2'@'localhost'; |
| 56 |
flush privileges; |
| 57 |
# Switch to (con2 localhost, user2, , ) |
| 58 |
update performance_schema.setup_actors |
| 59 |
set ENABLED='NO'; |
| 60 |
ERROR 42000: UPDATE command denied to user 'user2'@'localhost' for table 'setup_actors' |
| 61 |
insert into performance_schema.setup_actors |
| 62 |
values ('%', 'user1', '%', 'YES', 'YES'); |
| 63 |
insert into performance_schema.setup_actors |
| 64 |
values ('localhost', '%', '%', 'NO', 'NO'); |
| 65 |
insert into performance_schema.setup_actors |
| 66 |
values ('%', '%', '%', 'YES', 'YES'); |
| 67 |
# Switch to (con1, localhost, user1, , ) |
| 68 |
select NAME, TYPE, INSTRUMENTED, PROCESSLIST_USER, PROCESSLIST_HOST |
| 69 |
from performance_schema.threads |
| 70 |
where PROCESSLIST_ID = connection_id(); |
| 71 |
NAME TYPE INSTRUMENTED PROCESSLIST_USER PROCESSLIST_HOST |
| 72 |
thread/sql/one_connection FOREGROUND NO user1 localhost |
| 73 |
delete from performance_schema.setup_actors where |
| 74 |
HOST='localhost' and USER='user1'; |
| 75 |
# Switch to (con1, localhost, user1, , ) |
| 76 |
select NAME, TYPE, INSTRUMENTED, PROCESSLIST_USER, PROCESSLIST_HOST |
| 77 |
from performance_schema.threads |
| 78 |
where PROCESSLIST_ID = connection_id(); |
| 79 |
NAME TYPE INSTRUMENTED PROCESSLIST_USER PROCESSLIST_HOST |
| 80 |
thread/sql/one_connection FOREGROUND YES user1 localhost |
| 81 |
delete from performance_schema.setup_actors where |
| 82 |
HOST='%' and USER='user1'; |
| 83 |
# Switch to (con1, localhost, user1, , ) |
| 84 |
select NAME, TYPE, INSTRUMENTED, PROCESSLIST_USER, PROCESSLIST_HOST |
| 85 |
from performance_schema.threads |
| 86 |
where PROCESSLIST_ID = connection_id(); |
| 87 |
NAME TYPE INSTRUMENTED PROCESSLIST_USER PROCESSLIST_HOST |
| 88 |
thread/sql/one_connection FOREGROUND NO user1 localhost |
| 89 |
delete from performance_schema.setup_actors where |
| 90 |
HOST='localhost' and USER='%'; |
| 91 |
# Switch to (con1, localhost, user1, , ) |
| 92 |
select NAME, TYPE, INSTRUMENTED, PROCESSLIST_USER, PROCESSLIST_HOST |
| 93 |
from performance_schema.threads |
| 94 |
where PROCESSLIST_ID = connection_id(); |
| 95 |
NAME TYPE INSTRUMENTED PROCESSLIST_USER PROCESSLIST_HOST |
| 96 |
thread/sql/one_connection FOREGROUND YES user1 localhost |
| 97 |
revoke all privileges, grant option from user1@localhost; |
| 98 |
revoke all privileges, grant option from user2@localhost; |
| 99 |
drop user user1@localhost; |
| 100 |
drop user user2@localhost; |
| 101 |
flush privileges; |
| 102 |
truncate table performance_schema.setup_actors; |
| 103 |
insert into performance_schema.setup_actors |
| 104 |
values ('%', '%', '%', 'YES', 'YES'); |
| 105 |
select * from performance_schema.setup_actors; |
| 106 |
HOST USER ROLE ENABLED HISTORY |
| 107 |
% % % YES YES |