SHOW PRIVILEGES

SHOW PRIVILEGES 语句用于显示 TiDB 中可分配权限的列表。此列表为静态列表,不反映当前用户的权限。

语法图

ShowStmt:

ShowStmt

示例

1. show privileges;
1. mysql> show privileges;
2. +---------------------------------+---------------------------------------+-------------------------------------------------------+
3. | Privilege                       | Context                               | Comment                                               |
4. +---------------------------------+---------------------------------------+-------------------------------------------------------+
5. | Alter                           | Tables                                | To alter the table                                    |
6. | Alter routine                   | Functions,Procedures                  | To alter or drop stored functions/procedures          |
7. | Config                          | Server Admin                          | To use SHOW CONFIG and SET CONFIG statements          |
8. | Create                          | Databases,Tables,Indexes              | To create new databases and tables                    |
9. | Create routine                  | Databases                             | To use CREATE FUNCTION/PROCEDURE                      |
10. | Create role                     | Server Admin                          | To create new roles                                   |
11. | Create temporary tables         | Databases                             | To use CREATE TEMPORARY TABLE                         |
12. | Create view                     | Tables                                | To create new views                                   |
13. | Create user                     | Server Admin                          | To create new users                                   |
14. | Delete                          | Tables                                | To delete existing rows                               |
15. | Drop                            | Databases,Tables                      | To drop databases, tables, and views                  |
16. | Drop role                       | Server Admin                          | To drop roles                                         |
17. | Event                           | Server Admin                          | To create, alter, drop and execute events             |
18. | Execute                         | Functions,Procedures                  | To execute stored routines                            |
19. | File                            | File access on server                 | To read and write files on the server                 |
20. | Grant option                    | Databases,Tables,Functions,Procedures | To give to other users those privileges you possess   |
21. | Index                           | Tables                                | To create or drop indexes                             |
22. | Insert                          | Tables                                | To insert data into tables                            |
23. | Lock tables                     | Databases                             | To use LOCK TABLES (together with SELECT privilege)   |
24. | Process                         | Server Admin                          | To view the plain text of currently executing queries |
25. | Proxy                           | Server Admin                          | To make proxy user possible                           |
26. | References                      | Databases,Tables                      | To have references on tables                          |
27. | Reload                          | Server Admin                          | To reload or refresh tables, logs and privileges      |
28. | Replication client              | Server Admin                          | To ask where the slave or master servers are          |
29. | Replication slave               | Server Admin                          | To read binary log events from the master             |
30. | Select                          | Tables                                | To retrieve rows from table                           |
31. | Show databases                  | Server Admin                          | To see all databases with SHOW DATABASES              |
32. | Show view                       | Tables                                | To see views with SHOW CREATE VIEW                    |
33. | Shutdown                        | Server Admin                          | To shut down the server                               |
34. | Super                           | Server Admin                          | To use KILL thread, SET GLOBAL, CHANGE MASTER, etc.   |
35. | Trigger                         | Tables                                | To use triggers                                       |
36. | Create tablespace               | Server Admin                          | To create/alter/drop tablespaces                      |
37. | Update                          | Tables                                | To update existing rows                               |
38. | Usage                           | Server Admin                          | No privileges - allow connect only                    |
39. | BACKUP_ADMIN                    | Server Admin                          |                                                       |
40. | RESTORE_ADMIN                   | Server Admin                          |                                                       |
41. | SYSTEM_USER                     | Server Admin                          |                                                       |
42. | SYSTEM_VARIABLES_ADMIN          | Server Admin                          |                                                       |
43. | ROLE_ADMIN                      | Server Admin                          |                                                       |
44. | CONNECTION_ADMIN                | Server Admin                          |                                                       |
45. | PLACEMENT_ADMIN                 | Server Admin                          |                                                       |
46. | DASHBOARD_CLIENT                | Server Admin                          |                                                       |
47. | RESTRICTED_TABLES_ADMIN         | Server Admin                          |                                                       |
48. | RESTRICTED_STATUS_ADMIN         | Server Admin                          |                                                       |
49. | RESTRICTED_VARIABLES_ADMIN      | Server Admin                          |                                                       |
50. | RESTRICTED_USER_ADMIN           | Server Admin                          |                                                       |
51. | RESTRICTED_CONNECTION_ADMIN     | Server Admin                          |                                                       |
52. | RESTRICTED_REPLICA_WRITER_ADMIN | Server Admin                          |                                                       |
53. | RESOURCE_GROUP_ADMIN            | Server Admin                          |                                                       |
54. +---------------------------------+---------------------------------------+-------------------------------------------------------+
55. 49 rows in set (0.00 sec)

MySQL 兼容性

SHOW PRIVILEGES 语句与 MySQL 完全兼容。如发现任何兼容性差异,请在 GitHub 上提交 issue。

另请参阅