root@localhost[tempdb]> show binary logs;
+---------------+-----------+
| Log_name | File_size |
+---------------+-----------+
| binlog.000001 | 107 | --reset之后,从000001开始生成全新空日志
+---------------+-----------+
--expire_log系统变量控制二进制日志自动删除的天数。默认值为0,表示“没有自动删除”。启动时和二进制日志循环时可能删除。
root@localhost[tempdb]> show variables like 'expire_log%';
+------------------+-------+
| Variable_name | Value |
+------------------+-------+
| expire_logs_days | 0 |
+------------------+-------+
root@localhost[tempdb]> set expire_logs_days=7; --提示次系统变量为全局变量
ERROR 1229 (HY000): Variable 'expire_logs_days' is a GLOBAL variable and should be set with SET GLOBAL
root@localhost[tempdb]> set global expire_logs_days=7; --设置
Query OK, 0 rows affected (0.01 sec)
root@localhost[tempdb]> select @@expire_logs_days;
+--------------------+
| @@expire_logs_days |
+--------------------+
| 7 |
+--------------------+