I'm running MySQL 5.5
I wanted to truncate the slow log file, so I did:
SET GLOBAL slow_query_log = 0;
then truncated the file in filesystem.
But, when I enable it back it fails:
SET GLOBAL slow_query_log = 1;
ERROR 13 (HY000): Can't get stat of './mysql/slow_log.CSV' (Errcode: 2)
Although the slow_query_log_file
set explicitly to another path.
SHOW GLOBAL VARIABLES LIKE 'slow_query%';
+------------------------------------+---------------------------------+
| Variable_name | Value |
+------------------------------------+---------------------------------+
| slow_query_log | OFF |
| slow_query_log_file | /home/mysql_data/jobs1-slow.log |
| slow_query_log_timestamp_always | OFF |
| slow_query_log_timestamp_precision | second |
| slow_query_log_use_global_control | |
+------------------------------------+---------------------------------+
What is wrong? I want MySQL log to the specified file. Plain text, not CSV.
SHOW GLOBAL VARIABLES LIKE 'log_output';
+---------------+-------+
| Variable_name | Value |
+---------------+-------+
| log_output | FILE |
+---------------+-------+
Before I stopped it logging was fine.
Best Answer
I did these steps :
set global slow_query_log=0;
set global slow_query_log=1;
it works fine, so I tried these steps:
still works, and new slow log file is generated as
/tmp/slow.log
.At last, the value of global variable
log_output
decides where to generate the general log and slow log's output, not the file format.