1.查看binlog日志
mysql> show binary logs;
+---------------+-----------+
| Log_name | File_size |
+---------------+-----------+
| binlog.007480 | 198 |
| binlog.007481 | 795 |
| binlog.007482 | 1203872 |
| binlog.007483 | 795 |
| binlog.007484 | 198 |
| binlog.007485 | 795 |
| binlog.007486 | 1482097 |
| binlog.007487 | 795 |
| binlog.007488 | 198 |
| binlog.007489 | 789 |
| binlog.007490 | 1333935 |
+---------------+-----------+
11 rows in set (0.00 sec)
2、删除某个日志文件之前的所有日志文件
mysql> purge binary logs to 'binlog.007488';
Query OK, 0 rows affected (0.13 sec)
mysql> show binary logs;
+---------------+-----------+
| Log_name | File_size |
+---------------+-----------+
| binlog.007488 | 198 |
| binlog.007489 | 789 |
| binlog.007490 | 1389313 |
+---------------+-----------+
3 rows in set (0.08 sec)
3、重置所有日志
日志文件编号又从000001开始
mysql> reset master;
Query OK, 0 rows affected (0.22 sec)
mysql> show binary logs;
+---------------+-----------+
| Log_name | File_size |
+---------------+-----------+
| binlog.000001 | 2644 |
+---------------+-----------+
1 row in set (0.00 sec)
4、关闭mysql的binlog日志
#log-bin=mysql-bin 在my.cnf里面注释掉binlog日志
重启mysql
service mysqld restart
网友评论