.Binlog空间维护
一,显示当前的logs文件记录
show master logs;
二,清空n天前的日志,减少磁盘空间
PURGE MASTER LOGS BEFORE DATE_SUB(CURRENT_DATE, INTERVAL 10 DAY);
三,更改配置文件,指定binlog过期日期及binlog存储的物理位置。
My.cnf
[client] port=3306 socket=/mysql/mysql.sock default-character-set=utf8 [mysqld] port=3306 user=mysql default-storage-engine=INNODB basedir=/mysql/mysql datadir=/mysql/data pid-file=/mysql/mysql.pid socket=/mysql/mysql.sock log_error=/mysql/error.log max_allowed_packet=500M max_connections=10000 server-id=666 expire_logs_days = 30 log-bin=/sql_bak/log_bin/mysql-bin binlog-format=mixed character-set-server=utf8 sql_mode=NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
四,重启Mysql,使设置生效。