How to empty or delete /var/lib/mysql/ .err files? | Web Hosting | Domain Registration | Wordpress Hosting | SSL Certificates

How to empty or delete /var/lib/mysql/ .err files?

You can clear the /var/lib/mysql/.err files, but if you have a lot of errors outputting into the error log, then you would probably want to check why that is happening. You should not delete the file, though, just clear it:

cat /dev/null > /var/lib/mysql/filename.err
As for the ibdata1 file, please do not remove or clear that file. That contains data for InnoDB table storage engine. MySQL will cease functioning properly if you clear or remove that file in any way.

you can also set a cron job to do so:

command="cat /dev/null > /var/lib/mysql/file.err"
job="0 0 * * 0 $command"
cat <(fgrep -i -v "$command" <(crontab -l)) <(echo "$job") | crontab -