Debian Codegraph @

mysql-test/suite/perfschema/t/is_privilege.test

raw
1 # Create a test user
2 CREATE USER test@localhost;
3
4 #Connect to the database as the test user
5 connect (con1, localhost, test, , );
6
7 #see if world-only tables are visible
8 SELECT table_name FROM information_schema.TABLES WHERE TABLE_SCHEMA='performance_schema' ORDER BY table_name;
9
10 #go back to the default connection
11 --connection default
12
13 #cond_instances will check for PFS_readonly_acl::check
14 GRANT SELECT ON performance_schema.cond_instances TO test@localhost;
15
16 #setup_consumers will check for PFS_updatable_acl::check
17 GRANT SELECT ON performance_schema.setup_consumers TO test@localhost;
18
19 #accounts will check for PFS_truncatable_acl::check
20 GRANT SELECT ON performance_schema.accounts TO test@localhost;
21
22 #setup_objects will check for PFS_editable_acl::check
23 GRANT SELECT ON performance_schema.setup_objects TO test@localhost;
24
25 #again connect to the database as test user
26 --connection con1
27
28 #see if both world-only, and above mentioned tables are visible to the test user
29 SELECT table_name FROM information_schema.TABLES WHERE TABLE_SCHEMA='performance_schema' ORDER BY table_name;
30
31 # Make sure visible tables have visible columns
32 SELECT TABLE_SCHEMA, TABLE_NAME, COLUMN_NAME, ORDINAL_POSITION
33 FROM INFORMATION_SCHEMA.COLUMNS
34 WHERE TABLE_SCHEMA='performance_schema'
35 AND TABLE_NAME IN ('accounts', 'cond_instances', 'setup_consumers',
36 'setup_objects', 'processlist', 'global_status')
37 ORDER BY TABLE_SCHEMA, TABLE_NAME, ORDINAL_POSITION, COLUMN_NAME;
38
39 #go back to the default connection
40 --connection default
41
42 #revoke the privileges
43 REVOKE ALL PRIVILEGES, GRANT OPTION FROM test@localhost;
44
45 #drop the user, clean up done
46 DROP USER test@localhost;