Search code examples
mariadbmysql-slow-query-log

mariadb slow query not logged


As the title suggests, no log is recorded in the log file even though the related settings have been completed.

slow_query_log_file    = /var/log/mysql/mariadb-slow.log
slow_query_log         = 1
long_query_time        = 1
log_slow_rate_limit    = 1000
log_slow_verbosity     = query_plan
log-queries-not-using-indexes

This is mariadb's conf content. When you open the log file, only the basics exist.

Tcp port: 3306  Unix socket: /run/mysqld/mysqld.sock
Time            Id Command  Argument

logrotate seems to work fine. After connecting to mysql, I used select sleep(); but it did not work properly. The result after using the command is 0, which seems to be normal, but the log is not recorded.

Why wouldn't it work?


Solution

  • The new settings will apply only if the MariaDB server instance is restarted. Therefore, the solution, as mentioned in the comment, is to restart the MariaDB server instance in order to apply the new settings.