retechpro

Well-Known Member
Dec 23, 2022
141
16
18
Pakistan
cPanel Access Level
Root Administrator
Hi,
today i check my server /var/log and ls -lha | grep mysql it show two files.

-rw-r-----. 1 mysql mysql 42G Jul 22 09:00 mysqld.log
drwxr-xr-x 2 mysqlrouter mysqlrouter 4.0K May 31 17:45 mysqlrouter

mysqld.log file is 42g. is it normal? or should i have to delete it. why it become to larger.
 
Last edited by a moderator:

kodeslogic

Well-Known Member
PartnerNOC
Apr 26, 2020
599
273
138
IN
cPanel Access Level
Root Administrator
A 42GB MySQL log file (mysqld.log) is unusually large and might indicate an issue with your MySQL server's logging settings or database activity. Log files are used to record various events and activities in MySQL, and they can grow over time depending on the level of logging enabled and the amount of activity on the server.
  • If the log file contains valuable information for debugging or monitoring purposes, consider implementing log rotation to manage log file sizes automatically.
  • If the log file contains errors or warnings, address the underlying issues causing those errors to reduce future log growth.
  • If the log file doesn't seem to have any critical information and you have limited disk space, you might consider deleting the file.
 

retechpro

Well-Known Member
Dec 23, 2022
141
16
18
Pakistan
cPanel Access Level
Root Administrator
A 42GB MySQL log file (mysqld.log) is unusually large and might indicate an issue with your MySQL server's logging settings or database activity. Log files are used to record various events and activities in MySQL, and they can grow over time depending on the level of logging enabled and the amount of activity on the server.
  • If the log file contains valuable information for debugging or monitoring purposes, consider implementing log rotation to manage log file sizes automatically.
  • If the log file contains errors or warnings, address the underlying issues causing those errors to reduce future log growth.
  • If the log file doesn't seem to have any critical information and you have limited disk space, you might consider deleting the file.
I’m not the expert. I don’t know it any important information is in log file. How can i check?
If i delete, will i face any issue?
 

kodeslogic

Well-Known Member
PartnerNOC
Apr 26, 2020
599
273
138
IN
cPanel Access Level
Root Administrator
Deleting the log file does not affect the service, but might make it difficult to diagnose issues in the future. Instead, you can truncate the log file to a smaller size using the below command.

Code:
#truncate -s 50M /var/log/mysqld.log
It will reduce the file size to the most recent 50 Megabytes of data (retains the newest data and removes all older data in the file above the 50M in size). So once you find the system admin you can ask him to analyze the logs to identify any unusual events or errors that might be contributing to the excessive size.
 

retechpro

Well-Known Member
Dec 23, 2022
141
16
18
Pakistan
cPanel Access Level
Root Administrator
Deleting the log file does not affect the service, but might make it difficult to diagnose issues in the future. Instead, you can truncate the log file to a smaller size using the below command.

Code:
#truncate -s 50M /var/log/mysqld.log
It will reduce the file size to the most recent 50 Megabytes of data (retains the newest data and removes all older data in the file above the 50M in size). So once you find the system admin you can ask him to analyze the logs to identify any unusual events or errors that might be contributing to the excessive size.
Thank you for your help. I’ve run this command and now its size is 50M.
 

kodeslogic

Well-Known Member
PartnerNOC
Apr 26, 2020
599
273
138
IN
cPanel Access Level
Root Administrator
I am glad I was able to help.