MySQL 8.0 参考手册  / 第 5 章 MySQL 服务器管理  /  5.3 mysql系统数据库

5.3 mysql系统数据库

mysql数据库是系统数据库 。它包含存储 MySQL 服务器运行时所需信息的表。

数据库中的表mysql分为以下几类:

本节的其余部分列举了每个类别中的表格,并带有交叉引用以获取更多信息。MyISAM除非另有说明,否则 系统表使用存储引擎。

警告

不要数据库中的 MySQL 系统表 mysql从转换MyISAMInnoDB表。这是不受支持的操作。如果这样做,MySQL 不会重新启动,直到您从备份中恢复旧系统表或通过重新初始化数据目录重新生成它们(请参阅 第 2.10.1 节,“初始化数据目录”)。

授予系统表

这些系统表包含有关用户帐户及其拥有的权限的授权信息:

  • user:用户帐户、全局权限和其他非权限列。

  • db:数据库级权限。

  • tables_priv:表级权限。

  • columns_priv: 列级权限。

  • procs_priv: 存储过程和函数权限。

  • proxies_priv: Proxy-user privileges.

For more information about the structure, contents, and purpose of the grant tables, see Section 6.2.3, “Grant Tables”.

Object Information System Tables

These system tables contain information about stored programs, loadable functions, and server-side plugins:

Log System Tables

The server uses these system tables for logging:

  • general_log: The general query log table.

  • slow_log: The slow query log table.

Log tables use the CSV storage engine.

For more information, see Section 5.4, “MySQL Server Logs”.

Server-Side Help System Tables

These system tables contain server-side help information:

  • help_category: Information about help categories.

  • help_keyword: Keywords associated with help topics.

  • help_relation: Mappings between help keywords and topics.

  • help_topic: Help topic contents.

These tables use the InnoDB storage engine as of MySQL 5.7.5, MyISAM before that.

For more information, see Section 5.1.14, “Server-Side Help Support”.

Time Zone System Tables

These system tables contain time zone information:

  • time_zone: Time zone IDs and whether they use leap seconds.

  • time_zone_leap_second: When leap seconds occur.

  • time_zone_name: Mappings between time zone IDs and names.

  • time_zone_transition, time_zone_transition_type: Time zone descriptions.

These tables use the InnoDB storage engine as of MySQL 5.7.5, MyISAM before that.

For more information, see Section 5.1.13, “MySQL Server Time Zone Support”.

Replication System Tables

The server uses these system tables to support replication:

Optimizer System Tables

These system tables are for use by the optimizer:

These tables use the InnoDB storage engine.

Miscellaneous System Tables

Other system tables do not fall into the preceding categories: