https://dev.to/markyu/mysql-performance-monitoring-and-query-analysis-2co#:~:text=MySQL%20Monitoring%20Analysis%20View%3A%20sys.&text=The%20sys.,%2C%20and%20user%2Drelated%20statistics. SET GLOBAL log_output='FILE';
It can also be set in a server option group in an option file prior to starting up the server. For example:
[mariadb] ... log_output=FILE slow_query_log slow_query_log_file=slow-queries.log
Writing the Slow Query Log to a Table
The slow query log can either be written to the slow_log table in the mysql database by setting the log_output system variable to TABLE
. It can be changed dynamically with SET GLOBAL. For example:
SET GLOBAL log_output='TABLE';