By default, MySQL 5.0 and above enables MySQL Binary Log. Keeping MySQL Binary Log might take up a lot of disk space for long run. Older MySQL Binary log can be removed in order to keep your hard disk space free.
MySQL Binary Log stores query event such as add, delete and update in a very details way. The Binary Log is used for two main purposes;
* 1. Replication between master and slave server, statement that has been made on Master server will later send it to slave server.
* 2. Recovery, certain recovery job required data stored in MySQL Binary Log.
MySQL binary log locate at folder data on database root file, with the naming convention of mysql-bin.. Sample of the binary files as shown below;
Can I remove MySQL Binary Log ?
Of course yes (drinking), as long as the data is replicated to Slave server, it’s safe to remove the file. It’s recommend only remove MySQL Binary Log older than 1 month.
Besides, if Recovery of data is the main concern, it’s recommend to archive MySQL Binary Log.
There are several ways to remove or clean up MySQL Binary Log, it’s not recommend to clean up the file manually, manually means running the remove command.
Purge Master Logs
If you ARE replicating, then you need to periodically RESET MASTER or PURGE MASTER LOGS to clear out the old logs as those files are necessary for the proper operation of replication. Use following command to purge master logs:
$ mysql -u root -p ‘MyPassword’ -e “PURGE BINARY LOGS TO ‘mysql-bin.03’;”
OR
$ mysql -u root -p ‘MyPassword’ -e “PURGE BINARY LOGS BEFORE ‘2008-12-15 10:06:06’;”
Hello, Neat post. There is a problem together with your website in web explorer,
might check this? IE nonetheless is the market leader and a good component of folks will pass over your wonderful
writing due to this problem.