How to set "performance_schema on" in mysql?

Vikrant More picture Vikrant More · Mar 26, 2015 · Viewed 13.7k times · Source

I want to turn performance_schema ON in mysql to collect statistics.

How can I achieve this?

Answer

sjas picture sjas · Mar 26, 2015

The following guide is linux-specific, but should easily be adaptable to windows.

You have to check if the mysql server version you use, is compiled with support for it:

mysqld --verbose --help | grep performance-schema

If you can read something there, you are good to go.

Enable it on server startup by putting into /etc/mysql/my.cnf

[mysqld]
performance_schema

Afterwards do a service mysqld restart (redhat) (or service mysql restart on debian/ubuntu) to restart the mysql server.

On how to use the performance schema engine and its output, see the manual:
https://dev.mysql.com/doc/refman/5.5/en/performance-schema-quick-start.html