четверг, 28 апреля 2016 г.

MySQL Remove bin-log by the variable expire_log_days

2, Remove bin-log by the variable expire_log_days
An alternative option is to set “expire_log_days” as MySQL server parameter. The default values for expire_log_days is not to purge logs. You can either set it in MySQL’s configuration file or in a command terminal like below:
mysql> SET GLOBAL expire_logs_days = 7;
Query OK, 0 rows affected (0.00 sec)

mysql> show variables like 'expire_%';
+------------------+-------+
| Variable_name    | Value |
+------------------+-------+
| expire_logs_days |  7    |
+------------------+-------+
1 row in set (0.00 sec)
When this vavirable takes effect, the log files will be removed automatically on a weekly basis.

UPDATE:

You can remove binlog files by "PURGE BINARY LOGS"  command.

examples:
 
PURGE BINARY LOGS TO 'mysql-bin.010';
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).

Комментариев нет:

Отправить комментарий

Примечание. Отправлять комментарии могут только участники этого блога.