Nov 5, 2017

How to set MySQL Slow Query Log location

To disable or enable the slow query log or change the log file name at runtime, use the global slow_query_log and slow_query_log_file system variables. Set slow_query_log to 0 (or OFF) to disable the log or to 1 (or ON) to enable it. Set slow_query_log_file to specify the name of the log file. If a log file already is open, it is closed and the new file is opened.

Command-Line Format--slow-query-log-file=file_name
System VariableNameslow_query_log_file
Variable ScopeGlobal
Dynamic VariableYes
Permitted ValuesTypefile name
Defaulthost_name-slow.log
The name of the slow query log file. The default value is host_name-slow.log, but the initial value can be changed with the --slow_query_log_file option.

Example:
set global slow_query_log_file = "/var/log/db-slow.log";