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