MySQL 5.6 Reference Manual Including MySQL NDB Cluster 7.3-7.4 Reference Guide
For the Performance Schema to be available, it must be configured into the MySQL server at build time. Binary MySQL distributions provided by Oracle Corporation are configured to support the Performance Schema. If you use a binary MySQL distribution from another provider, check with the provider whether the distribution has been appropriately configured.
If you build MySQL from a source distribution, enable the
Performance Schema by running CMake with the
WITH_PERFSCHEMA_STORAGE_ENGINE
option enabled:
shell> cmake . -DWITH_PERFSCHEMA_STORAGE_ENGINE=1
Configuring MySQL with the
-DWITHOUT_PERFSCHEMA_STORAGE_ENGINE=1
option prevents inclusion of the Performance Schema, so if you
want it included, do not use this option. See
Section 2.9.7, “MySQL Source-Configuration Options”.
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 ...
To correct that problem, perform the MySQL upgrade procedure. See Section 2.11, “Upgrading MySQL”.
To verify whether a server was built with Performance Schema
support, check its help output. If the Performance Schema is
available, the output includes several variables with names that
begin with performance_schema
:
shell> mysqld --verbose --help
...
--performance_schema
Enable the performance schema.
--performance_schema_events_waits_history_long_size=#
Number of rows in events_waits_history_long.
...
You can also connect to the server and look for a line that names
the PERFORMANCE_SCHEMA
storage engine
in the output from SHOW ENGINES
:
mysql> SHOW ENGINES\G
...
Engine: PERFORMANCE_SCHEMA
Support: YES
Comment: Performance Schema
Transactions: NO
XA: NO
Savepoints: NO
...
If the Performance Schema was not configured into the server at
build time, no row for
PERFORMANCE_SCHEMA
appears in the
output from SHOW ENGINES
. You might
see performance_schema
listed in the output
from SHOW DATABASES
, but it
contains no tables and you cannot use it.
A line for PERFORMANCE_SCHEMA
in the
SHOW ENGINES
output 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.