makstaks
makstaks

Reputation: 2111

turn on mysql profiler globally

I want to profile all mysql sessions using mysql profiler, how can I turn on profiling globally?

thanks!

Upvotes: 12

Views: 4445

Answers (1)

Mark Madej
Mark Madej

Reputation: 1922

I think you can run these commands to enable profiling:

SET GLOBAL slow_query_log = 'ON';
SET GLOBAL slow_query_log_file = '/var/log/mysql/localhost-slow.log';
SET GLOBAL log_queries_not_using_indexes = 'ON';
SET SESSION long_query_time = 1;
SET SESSION min_examined_row_limit = 100;

The settings will not persist after you reboot the server - if you want these enabled upon the next server restart, you can add them to your my.cnf configuration file:

[mysqld]
slow-query-log = 1
slow-query-log-file = /var/log/mysql/localhost-slow.log
long_query_time = 1
log-queries-not-using-indexes

Info from this page.

Upvotes: 3

Related Questions