How to Enable MySQL Slow Query Log Without Server Restart
Q: I can only set the slow query threshold with the method recommended at http://crazytoon.com/2007/07/23/. Is there anything else needed, such as specifying a filepath?
A: According to the MySQL documentation, the default slow query log file name is host_name-slow.log located in the data directory. If you don't see a log file when running SHOW VARIABLES, it's likely because you're using MySQL version 5.0.77 or earlier. For these versions, use the following command:
SET GLOBAL log_slow_queries = 1;
However, since MySQL 5.1, you can use the following command:
SET GLOBAL slow_query_log = 'ON';
Remember to flush the logs with FLUSH LOGS.
Disclaimer: All resources provided are partly from the Internet. If there is any infringement of your copyright or other rights and interests, please explain the detailed reasons and provide proof of copyright or rights and interests and then send it to the email: [email protected] We will handle it for you as soon as possible.
Copyright© 2022 湘ICP备2022001581号-3