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)


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?

  • Please post in the question how you defined the general log and error log in my.cnf – RolandoMySQLDBA Sep 8 '17 at 16:28

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 via general_log=1

| improve this answer | |
  • And set log_output=FILE. – Rick James Sep 8 '17 at 19:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.