MySQL cleanup binary log (XF version)

Source: Internet
Author: User

Automatic cleanup Dynamic settings

Executes the query in the terminal to check the current binary log timeout.

The default is 0, which means never time out

mysql> show variables like  ‘%expire_logs_days%‘ ; +------------------+-------+ | Variable_name    | Value | +------------------+-------+ | expire_logs_days |  0 | +------------------+-------+ 1 row in set ( 0.00 sec)


Set retention for 14 days with the following command

set global expire_logs_days = 14;

triggered automatically when MySQL switches logs.

can be flush logs by command; Trigger manually. (manual triggering is not recommended)


Configuration file

The run-time settings are not valid after a restart, and the configuration file needs to be set to ensure that the restart is valid.

/etc/my.cnf

[Mysqld]

expire_logs_days= 14




can be manually cleaned by the following command, due date   or   file name.

-- 截止到 2016-07-01 00:00:00 PURGE MASTER LOGS BEFORE  ‘2016-07-01 00:00:00‘ ; -- 截止到文件 mysql-bin.001000 PURGE MASTER LOGS  TO ‘mysql-bin.001000‘ ;



This article is from the "Intelligent Future _XFICC" blog, please be sure to keep this source http://xficc.blog.51cto.com/1189288/1833337

MySQL cleanup binary log (XF version)

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.