Binlog Processing Method for MySQL DATA
Recently, the disk has grown very fast and it is found that binlog logs occupy a large amount of disk resources. We use manual cleanup, and set Automatic cleanup later.
View the specified deletion log
Mysql> show binary logs; check the amount of binlog logs and space occupied.
Mysql> purge master logs to 'mysql-bin.002467 '; delete all previous binlogs of the mysql-bin.002467 so that deletion can ensure that *. index information is synchronized with the binlog file.
Manual cleanup
Mysql> purge master logs before DATE_SUB (CURRENT_DATE, INTERVAL 5 DAY); manually delete binlog LOGS 5 days ago
Automatic Cleaning
Mysql> set global expire_logs_days = 5; set the binlog expiration time to 5 days;
Mysql> flush logs; click log to make the preceding settings take effect; otherwise, the settings do not take effect.
To ensure that MYSQL is still valid after restart, add this parameter in my. cnf.
Expire_logs_days = 5
MySQL Data Recovery-binlog
Clear binlog logs in MySQL
How to safely delete binlog logs under MySQL
MySQL -- binlog log data recovery
How does MySQL Delete binlog and restore Data?
Introduction and Analysis of Three MySQL binlog formats
MySQL uses binlog Incremental backup + restore instance
MySQL deletes binlog logs and restores data.
This article permanently updates the link address: