Howto log slow MySQL Queries in Debian

Submitted by rex on Sun, 05/30/2010 - 17:20

Sometimes MySQL use a lot of CPU and its really slow.
If you want to log the queries just comment out following lines in '/etc/mysql/my.cnf'

# Here you can see queries with especially long duration
log_slow_queries = /var/log/mysql/mysql-slow.log
long_query_time = 10

If a query need more then 10 seconds to get executed mysql will log it in '/var/log/mysql/mysql-slow.log'