MySQL 8.4 包含 sys 架构,这是一组帮助数据库管理员和开发人员解释性能架构收集的数据的对象。sys 架构对象可用于典型的调优和诊断用例。该架构中的对象包括:MySQL 8.4 includes the
sys schema, a set of objects that
helps DBAs and developers interpret data collected by the
Performance Schema. sys schema objects
can be used for typical tuning and diagnosis use cases. Objects in
this schema include:
将性能架构数据汇总为更易理解形式的视图。Views that summarize Performance Schema data into more easily understandable form.
执行操作的存储过程,例如性能架构配置和生成诊断报告。Stored procedures that perform operations such as Performance Schema configuration and generating diagnostic reports.
查询性能架构配置并提供格式化服务的存储函数。Stored functions that query Performance Schema configuration and provide formatting services.
对于新安装,如果在使用 mysqld 时使用 --initialize 或 --initialize-insecure 选项进行数据目录初始化,sys 模式会默认安装。如果不需要,可以在初始化后手动删除 sys 模式。For new installations, the sys schema
is installed by default during data directory initialization if you
use mysqld with the
--initialize or
--initialize-insecure option. If this
is not desired, you can drop the sys
schema manually after initialization if it is unneeded.
如果存在 sys 模式,但没有 version 视图,则 MySQL 升级过程会产生错误,因为假设缺少此视图表示这是用户创建的 sys 模式。在这种情况下进行升级时,请先删除或重命名现有的 sys 模式。The MySQL upgrade procedure produces an error if a
sys schema exists but has no
version view, on the assumption that
absence of this view indicates a user-created sys
schema. To upgrade in this case, remove or rename the existing
sys schema first.
sys 架构对象的 DEFINER 为 'mysql.sys'@'localhost'。使用专用的 mysql.sys 帐户可以避免 DBA 重命名或删除 root 帐户时可能发生的问题。sys schema objects have a
DEFINER of
'mysql.sys'@'localhost'. Use of the dedicated
mysql.sys account avoids problems that occur if a
DBA renames or removes the root account.