Performance Schema 是必需的,并且总是编译在内。可以排除 Performance Schema 仪表的某些部分。例如,要排除阶段和语句仪表,请执行以下操作:The Performance Schema is mandatory and always compiled in. It is possible to exclude certain parts of the Performance Schema instrumentation. For example, to exclude stage and statement instrumentation, do this:
$>cmake . \-DDISABLE_PSI_STAGE=1 \-DDISABLE_PSI_STATEMENT=1
有关更多信息,请参阅 DISABLE_PSI_ CMake 选项的说明,见 第 2.8.7 节,“MySQL 源代码配置选项”。For more information, see the descriptions of the
XXXDISABLE_PSI_
CMake options in
Section 2.8.7, “MySQL Source-Configuration Options”.XXX
如果您在之前未配置 Performance Schema 的安装(或使用 Performance Schema 的旧版本且表缺失或过时)上安装 MySQL,则可能会出现此问题。此问题的一种迹象是在错误日志中出现类似如下的消息:If you install MySQL over a previous installation that was configured without the Performance Schema (or with an older version of the Performance Schema that has missing or out-of-date tables). One indication of this issue is the presence of messages such as the following in the error log:
[ERROR] Native table 'performance_schema'.'events_waits_history' has the wrong structure [ERROR] Native table 'performance_schema'.'events_waits_history_long' has the wrong structure ...
要解决该问题,请执行 MySQL 升级程序。参见 第 3 章,升级 MySQL。To correct that problem, perform the MySQL upgrade procedure. See Chapter 3, Upgrading MySQL.
由于性能模式(Performance Schema)在构建服务器时就已配置,因此在 SHOW ENGINES 的输出中会出现 PERFORMANCE_SCHEMA 的行。这意味着性能模式是可用的,但并不意味着它已启用。要启用它,必须在服务器启动时进行,如下一节所述。Because the Performance Schema is configured into the server at
build time, a row for
PERFORMANCE_SCHEMA appears in the
output from SHOW ENGINES. This
means that the Performance Schema is available, not that it is
enabled. To enable it, you must do so at server startup, as
described in the next section.