Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Linux by (18.4k points)

I worked on several commands such as (FLUSH LOGS, PURGE MASTER) but none deletes the log files (when previously activated) or the log tables (mysql/slow_log.CSV and mysql/general_log.CSV and their .frm and .CSM counterparts).

SHOW'S THE  BINARY LOGS returns "You are not using binary logging".

I found a simple solution to clear my table logs (but not yet my file logs using the MySQL command):

TRUNCATE mysql.general_log;

TRUNCATE mysql.slow_log;

1 Answer

0 votes
by (36.8k points)

FLUSH LOGS just closes and reopens log files. But if these log files are too large, it will not reduce them. If you're on Linux, you can use mv to rename log files while they're in use, and then after FLUSH LOGS, you know that MySQL is writing to the new, small file, and you can remove those old big files.

Binary logs are different. To eliminate the old binlogs, use the PURGE BINARY LOGS. Make sure the slaves (if any) aren't still using binary logs. That is run SHOW SLAVE STATUS to see what the binlog file they're working on, and don't purge the file or later files.

Also, keep in mind that binlogs are useful for point-in-time recovery in case you need to restore from the backups and then reapply in on binlogs to bring the database up to date. If you need to use the binlogs in this manner, don't purge your binlogs that have been written since your last backup.

Come and join Linux training to gain great knowledge. 

Do check out the video below

Related questions

0 votes
1 answer
0 votes
1 answer
0 votes
1 answer

Browse Categories

...