Project:MySQL

From MaRDI portal
Revision as of 14:27, 28 October 2024 by Larissa (talk | contribs) (Created page with "== Heading text == How to use the slow query log Set the slow query log to "on", by doing one of these things: For a permanent solution, edit `my.cnf` and set: slow_query_log = 1 slow_query_log_file = /var/lib/mysql/slow.log long_query_time = 1 #your time in seconds, the lower it is, the more will be logged For a temporary solution, log in to mysql as root and execute: SET GLOBAL slow_query_log = 'ON'; SET GLOBAL slow_query_log_file = '/var/lib/mysql/slow.log'; SET GLOBA...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Heading text

How to use the slow query log Set the slow query log to "on", by doing one of these things: For a permanent solution, edit `my.cnf` and set: slow_query_log = 1 slow_query_log_file = /var/lib/mysql/slow.log long_query_time = 1 #your time in seconds, the lower it is, the more will be logged For a temporary solution, log in to mysql as root and execute: SET GLOBAL slow_query_log = 'ON'; SET GLOBAL slow_query_log_file = '/var/lib/mysql/slow.log'; SET GLOBAL long_query_time = 1; #your time in seconds, the lower it is, the more will be logged Leave it running as long as desired. Then, go to location of slow log file and run mysqldumpslow ./slow.log to get a summary of the queries.