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;

Comments

  1. It can be automated through shell script or.bat script, why should we do it manually

    ReplyDelete
    Replies
    1. I have tried manual script. Please share .bat/shell script to automate this process. thank you in advance

      Delete

Post a Comment

Popular Posts