Safely Rotating MySQL Slow Query Logs
1. get the path to slow query log file
show variables like '%slow_query%';
2.temporarily disable slow query logging
set global slow_query_log=off;
3.rename the old log file and or compress it
4.flush only slow logs
flush slow logs;
5.finally, re-enable slow query logging
set global slow_query_log=on;
It can be automated through shell script or.bat script, why should we do it manually
ReplyDeleteI have tried manual script. Please share .bat/shell script to automate this process. thank you in advance
Delete