For Performance Schema to be available, it must be configured into the MySQL server at build time. Binary MySQL distributions provided by Sun Microsystems, Inc. are configured to support 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 Performance Schema by running configure with one of the following options:
The --with-perfschema
or
--with-plugins=perfschema
option enables
Performance Schema.
The --with-plugins=max
option enables a
collection of features, including Performance Schema. If you
want finer control, use one of the other options.
If you specify none of the preceding options, Performance Schema
is included by default. If you normally specify
--with-plugins
to name plugins to build, you
can add perfschema
or max
to the list of names. For example:
shell> ./configure --with-plugins=innobase,perfschema
If you install MySQL over a previous installation that was
configured without Performance Schema, run
mysql_upgrade after starting the server to
create the performance_schema
database.
To verify whether a server was built with Performance Schema
support, check its help output. If Performance Schema is
available, the output will mention 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 Performance Schema was not configured into the server at
build time, no row for
PERFORMANCE_SCHEMA
will appear in
the output from SHOW ENGINES
. You
might see performance_schema
listed in the
output from SHOW DATABASES
, but
it will have no tables and you will not be able to use it.
A line for PERFORMANCE_SCHEMA
in
the SHOW ENGINES
output means
that 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.