DBAtlas · Database operations atlas

Enable the general and slow query logs

MySQLBinlog & Log

Command

SET GLOBAL slow_query_log = 'ON'; SET GLOBAL long_query_time = 1; SET GLOBAL general_log = 'ON';

What it does

Enables, at run time, the slow query log (queries longer than 1 second) and the general log that records every query.

When to use it

To temporarily analyze slow queries or all query traffic.

Caution

general_log adds significant performance and disk overhead; always turn it off when diagnostics are done (SET GLOBAL general_log='OFF'). These settings reset on restart; use SET PERSIST to make them permanent.

Open in DBAtlas →

Related