Latest news from 5wire Networks

Safely empty MySQL .log & .err files on cPanel Servers

Over time the .log & .err files on cPanel servers can become huge, more often that not you should always investigate what is causing these files to generate to huge capacity in case there are issues with the databases that you are running.

We always investigate and keep our servers tidy, so ensuring these are regularly cleaned help us to monitor and fix any problems with MySQL.

cat /dev/null is often referred to a black hole in Linux based systems because it discards all data written and sends End of File character to any process reading data from it. This lets us clear the contents of a file.

Navigate to the MySQL directory on cPanel

cd /var/lib/mysql/

Run ls -l to find your file

ls -l

Clear the contents of the MySQL Error Log and Log File

cat /dev/null > /var/lib/mysql/mysql.server.com.err

cat /dev/null > /var/lib/mysql/mysql.server.com.log

Check the files are empty

ls -l mysql.server.com.err

ls -l mysql.server.com.log

2 Comments

Comments are closed.