Enable slow query log on MySQL server
Posted on: June 4, 2015 /
Categories: MySQL
Set it temporarily, by running the following commands on mysql console:
set global slow_query_log = 1;
set global slow_query_log_file = '/var/log/mysql-slow.log';
the changes will be undone when mysql is restarted.
Set it permanently, by adding the following in “my.cnf” file:
slow-query-log=1
slow-query-log-file=/var/log/mysql-slow.log
The location of my.cnf varies by OS, but is often found in /etc/my.cnf, or /etc/mysql/my.cnf. After saving your changes, you will need to restart MySQL.