SHOW PRIVILEGES

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

语法图

ShowStmt:

ShowStmt

示例

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

MySQL 兼容性

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

另请参阅