I deleted mysql.log
using rm
. I recreated it using the touch
command but it seems like mysql cannot find it. I tried SET GLOBAL general_log = 1;
and I got the following error. I can't find any information on the right way to recreate mysql.log
ERROR 29 (HY000): File '/var/log/mysql/mysql.log' not found (Errcode: 13)
Edit:
I resolved it. I removed the log file again and ran SET GLOBAL general_log = 1;
MySQL recreated the log file.
Edit 2:
It seems that I was wrong. I deleted the file again and ran that command and nothing happened. I guess there is an automated process in the background which creates the file again?
Best Answer
You have to disable general logging and enable it again to recreate the log file.
When you enable logging existing file is used or new one is created and its inode is used as filedescriptor for writing. If you delete already opened file filedescriptor is pointing to the nonexisting file. You should close file via
general_log=0
and reopen it again viageneral_log=1