Erik Liljencrantz - 2022-10-13 23:20:43
Using the server global variables may be easier than restarting the DB server. Also adjusting what is considered slow, i.e. setting the long_query_time variable.
Start mysql on command line, then check variables:
show global variables like "%slow%";
show global variables like "%long%";
Enable log, above 0.5 second:
set global slow_query_log=ON;
set long_query_time=0.5;
For production You can still keep it turned on, but raise "what is considered slow" and limit logging rate:
set long_query_time=2;
set log_slow_rate_limit=2;
And of course, adjust settings in my.cnf / server.cnf or similar for good values after any restart.