How to enable slow query log in mysql – aktivieren – bad performance logging
mysql -uroot -p
set global slow_query_log =’ON‘;
set global log_queries_not_using_indexes =’ON‘;
set global slow_query_log_file =’/var/log/mysql/slow-query.log‘;
set global long_query_time = 5;
show variables like ‚%slow%‘;
/etc/init.d/mysql restart
tailf -n 100 /var/log/mysql/slow-query.log
Troubleshooting:
mysql> set global long_query_time = ‚5‘;
ERROR 1232 (42000): Incorrect argument type to variable ‚long_query_time‘
Use -> set global long_query_time = 5;