MySQL各种日志介绍(2)


二进制日志文件安全的的删除方法(删除前请备份):
语法: PURGE { BINARY | MASTER } LOGS  { TO 'log_name' | BEFORE datetime_expr }
mysql> SHOW BINARY LOGS;
+------------------+-----------+
| Log_name        | File_size |
+------------------+-----------+
| mysql-bin.000001 |    27702 |
| mysql-bin.000002 |  1063490 |
| mysql-bin.000003 |      733 |
| mysql-bin.000004 |      150 |
| mysql-bin.000005 |      126 |
| mysql-bin.000006 |      126 |
| mysql-bin.000007 |      126 |
| mysql-bin.000008 |      126 |
| mysql-bin.000009 |      126 |
| mysql-bin.000010 |      126 |
| mysql-bin.000011 |      381 |
| mysql-bin.000012 |      126 |
| mysql-bin.000013 |      1625 |
+------------------+-----------+
mysql> PURGE BINARY LOGS TO 'mysql-bin.000010';  #把此二进制日志文件之前的都删除
Query OK, 0 rows affected (0.04 sec)
mysql> SHOW BINARY LOGS;
+------------------+-----------+
| Log_name        | File_size |
+------------------+-----------+
| mysql-bin.000010 |      126 |
| mysql-bin.000011 |      381 |
| mysql-bin.000012 |      126 |
| mysql-bin.000013 |      1625 |

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/4a89e020490eb27b5fa6c4c25b269503.html