SHOW PRIVILEGES

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

语法图

ShowPrivilegesStmt

SHOW PRIVILEGES - 图1

1. ShowPrivilegesStmt ::=
2. "SHOW" "PRIVILEGES"

示例

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

MySQL 兼容性

SHOW PRIVILEGES 语句与 MySQL 完全兼容。如发现任何兼容性差异,请尝试 TiDB 支持资源。

另请参阅