Saturday, August 13, 2011

Remove MySQL Binary Log with PURGE BINARY LOGS Statement

A while ago I had a problem whereby on a very busy mysql cluster,
I had a problem whereby mysql was filling up /var. 
To fixed the problem, I made use of Linux's find and its ability to find 
all mysqls binary logs older than a certain date. 

Ive now discovered 'PURGE BINARY LOGS'.  
Heres my examples:

mysql -u username -p
mysql>PURGE BINARY LOGS TO 'mysql-bin.000005';
 
shell> mysql -u username -p
mysql> PURGE BINARY LOGS BEFORE '2011-08-13 00:00:00';


For more information. 
http://dev.mysql.com/doc/refman/5.0/en/purge-binary-logs.html 

No comments:

Post a Comment