Configuring MySQL Slow Query Log Without Server Restart
Question:
How can you activate MySQL's slow query log without the need for server restart?
Answer:
Dynamically activating the slow query log feature in MySQL requires specific steps, depending on the MySQL version used.
In MySQL versions 5.1 and later, use the following command:
SET GLOBAL slow_query_log = 'ON';
To prevent sensitive data from being stored in cleartext, execute the following command after enabling the log:
FLUSH LOGS;
Additional Considerations for MySQL 5.0:
Prior to MySQL 5.1, server restart was necessary to enable slow query logging. However, you can change the 'log_slow_queries' variable using 'SET GLOBAL' in MySQL 5.0, but it will display a "read-only variable" error.
Refer to MySQL documentation for configurations and log file location details:
The above is the detailed content of How to Enable MySQL\'s Slow Query Log Without Restarting the Server?. For more information, please follow other related articles on the PHP Chinese website!