联系:手机/微信(+86 17813235971) QQ(107644445)
作者:惜分飞©版权所有[未经本人同意,不得以任何形式转载,否则有进一步追究法律责任的权利.]
mysql> show BINARY logs;
+—————–+———–+
| Log_name | File_size |
+—————–+———–+
| mysqlbin.000001 | 107 |
+—————–+———–+
1 row in set (0.00 sec)
–查看当前bin_log情况
mysql> show master logs;
+—————–+———–+
| Log_name | File_size |
+—————–+———–+
| mysqlbin.000001 | 107 |
+—————–+———–+
1 row in set (0.00 sec)
–查看当前bin_log情况
mysql> show variables like ‘%log_bin%’;
+———————————+——-+
| Variable_name | Value |
+———————————+——-+
| log_bin | ON |
| log_bin_trust_function_creators | OFF |
| sql_log_bin | ON |
+———————————+——-+
3 rows in set (0.00 sec)
–查看log_bin相关配置
mysql> flush logs;
Query OK, 0 rows affected (0.06 sec)
–切换bin_log日志
mysql> PURGE BINARY LOGS TO ‘mysqlbin.000002′;
Query OK, 0 rows affected (0.03 sec)
–删除mysqlbin.000002之前的bin_log,并修改index中相关数据
mysql> PURGE BINARY LOGS BEFORE ’2011-07-09 12:40:26′;
Query OK, 0 rows affected (0.04 sec)
–删除2011-07-09 12:40:26之前的bin_log,并修改index中相关数据
mysql> PURGE BINARY LOGS BEFORE ’2011-07-09′;
Query OK, 0 rows affected (0.00 sec)
–删除2011-07-09之前的bin_log,并修改index中相关数据
mysql> set global expire_logs_days=5;
Query OK, 0 rows affected (0.00 sec)
–设置bin_log过期日期
mysql> reset master;
Query OK, 0 rows affected (0.02 sec)
–重设bin_log日志,以前的所有日志将被删除并且重设index中的数据
清空10天前日志
PURGE MASTER LOGS BEFORE DATE_SUB(CURRENT_DATE, INTERVAL 10 DAY);