如果在my.cnf中开启
log-bin=mysql-bin
mysql就会记录log,但是时间一长就会产生大量的日志,很占空间
117M mysql-bin.000030
478M mysql-bin.000031
1.1G mysql-bin.000032
963M mysql-bin.000033
4.0K mysql-bin.000034
1.1G mysql-bin.000035
1.1G mysql-bin.000036
30M mysql-bin.000037
8.0K mysql-bin.index
排除用脚本自动删除日志的方法,有2个方法可以清理这些东西
第一:关闭log-bin=mysql-bin
直接在my.cnf中注释掉这一行
#log-bin=mysql-bin
第二:使用命令清空
先查看下log
mysql> show master logs;
+------------------+------------+
| Log_name | File_size |
+------------------+------------+
| mysql-bin.000001 | 25818 |
| mysql-bin.000002 | 1073764880 |
| mysql-bin.000003 | 1073744915 |
| mysql-bin.000004 | 1073745502 |
| mysql-bin.000005 | 1073742693 |
| mysql-bin.000006 | 1073743058 |
| mysql-bin.000007 | 155022099 |
+------------------+------------+
7 rows in set (0.01 sec)
然后刷新
mysql> reset master;
Query OK, 0 rows affected, 36 warnings (0.05 sec)
再看下
mysql> show master logs;
+------------------+-----------+
| Log_name | File_size |
+------------------+-----------+
| mysql-bin.000001 | 107 |
+------------------+-----------+
1 row in set (0.00 sec)
这样只会保留最新的日志文件了,其他的就清空了~