v-lhb-db03:/data01/mysqllog/binlog# mysql -uroot -p1234567
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> PURGE BINARY LOGS TO 'mysql-bin.000001';
Query OK, 0 rows affected (0.02 sec)
mysql> quit
Bye
v-lhb-db03:/data01/mysqllog/binlog# cat mysql-bin.index
/data01/mysqllog/binlog/mysql-bin.000001
/data01/mysqllog/binlog/mysql-bin.000002
/data01/mysqllog/binlog/mysql-bin.000003
/data01/mysqllog/binlog/mysql-bin.000004
/data01/mysqllog/binlog/mysql-bin.000005
/data01/mysqllog/binlog/mysql-bin.000006
v-lhb-db03:/data01/mysqllog/binlog# ls -ltr
total 224216
-rw-rw---- 1 mysql mysql 120 Apr 29 15:48 mysql-bin.000001
-rw-rw---- 1 mysql mysql 229565040 Jun 2 09:28 mysql-bin.0
mysql清理binlog
最新推荐文章于 2024-09-19 16:10:05 发布
这篇博客展示了如何使用 MySQL 命令 `PURGE BINARY LOGS` 来清理过期的二进制日志文件,从而释放磁盘空间。通过指定日志文件名或日期,可以删除指定之前的全部二进制日志,同时更新日志索引文件。
摘要由CSDN通过智能技术生成