# touch /var/log/slow
# chown mysql:mysql /var/log/slowqueries
# mysql -e 'SET GLOBAL slow_query_log=1;'
# mysql -e 'SET GLOBAL slow_query_log_file="/var/log/slowqueries";'
# mysql -e 'SET GLOBAL long_query_time=5;'
Or I can add these lines to my.cnf:
slow_query_log=1
slow_query_log_file=/var/log/slowqueries
long_query_time=2
To test if it is working correctly, try:
# mysql -e 'SELECT SLEEP(6);'