Search code examples
mysqlloggingtruncate

Truncate Slow Query Log in MySQL


What's the safest way to truncate the MySQL slow query log (under Linux primarily, but Windows would be handy to know) while MySQL is running?

By safe I mean:

  • Mustn't cause any permissions problems
  • Mustn't jump back to its original size next time its appended to

Solution

  • To truncate a file regardless if it is open by a running application do:

    > /var/logs/your.log
    

    at your shell prompt.