Linux, FreeBSD, Juniper, Cisco / Network security articles and troubleshooting guides

It is currently Tue Mar 26, 2019 2:47 pm

Post a reply :: Mysql: Cleaning binary logs
Message body:
Enter your message here, it may contain no more than 60000 characters. 

:D :) ;) :( :o :shock: :? 8-) :lol: :x :P :oops: :cry: :evil: :twisted: :roll: :!: :?: :idea: :arrow: :| :mrgreen: :geek: :ugeek:
Font size:
Font colour
BBCode is ON
[img] is ON
[flash] is OFF
[url] is ON
Smilies are ON
Disable BBCode
Disable smilies
Do not automatically parse URLs
Confirmation code
Confirmation code:
In an effort to prevent automatic submissions, we require that you enter both of the words displayed into the text field underneath.

Topic review - Mysql: Cleaning binary logs
Author Message
Post subject: Re: Mysql: Cleaning binary logs  |  Post Posted: Tue May 18, 2010 9:45 am
You can also add to /etc/mysql/my.cnf (in Debian, google for the rest of the distributions) the following
expire_logs_days = 5

in order to keep only the last 5 days binary logs.

I'm almost sure that the normal user doesn't need then binary logs (except the case when they use master-slave replication or they know what they are doing), so why not disabling them completely? (mysql say that only 1% of the server speed is lost when bin logs are active but still that's something)
Comment log-bin directive in the /etc/mysql/my.cnf - Debian

Also, why not removing the binary logs (except the last one) with:
rm -rf file.XXXX

I didn't read anywhere that MySQL is keeping any "an eye" on those files...
Post subject: Mysql: Cleaning binary logs  |  Post Posted: Thu May 13, 2010 5:21 am
Here is how to purge or clean the MySql binary logs (NEVER remove them from the filesystem manually).

1. Using the "PURGE BINARY LOGS" command
mysql> PURGE BINARY LOGS TO 'mysql-bin.010';
mysql> PURGE BINARY LOGS BEFORE '2008-04-02 22:46:26';

The BEFORE variant's datetime_expr argument should evaluate to a DATETIME value (a value in 'YYYY-MM-DD hh:mm:ss' format).

Above commands will remove the binary logs from the disk.

2> Using the "RESET MASTER" command

Above command will empty the binary logs, but not remove them.

The above commands should not be used when/before binary logs are used for data integrity check or for replication.

From mysql manual:
You should not remove binary logs until you are certain that their contents have been processed by all slaves.

Further reading:
Jump to:  
News News Site map Site map SitemapIndex SitemapIndex RSS Feed RSS Feed Channel list Channel list

Delete all board cookies | The team | All times are UTC - 5 hours [ DST ]