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.000002
-rw-rw---- 1 mysql mysql 120 Jun 2 10:05 mysql-bin.000003
-rw-rw---- 1 mysql mysql 143 Jun 2 10:05 mysql-bin.000004
-rw-rw---- 1 mysql mysql 143 Jun 2 10:25 mysql-bin.000005
-rw-rw---- 1 mysql mysql 120 Jun 2 13:28 mysql-bin.000006
-rw-rw---- 1 mysql mysql 246 Jun 2 15:09 mysql-bin.index
v-lhb-db03:/data01/mysqllog/binlog# mysql -uroot -p1234567
mysql> PURGE BINARY LOGS TO 'mysql-bin.000002';
Query OK, 0 rows affected (0.01 sec)
mysql> quit
Bye
v-lhb-db03:/data01/mysqllog/binlog# ls -ltr
total 224212
-rw-rw---- 1 mysql mysql 229565040 Jun 2 09:28 mysql-bin.000002
-rw-rw---- 1 mysql mysql 120 Jun 2 10:05 mysql-bin.000003
-rw-rw---- 1 mysql mysql 143 Jun 2 10:05 mysql-bin.000004
-rw-rw---- 1 mysql mysql 143 Jun 2 10:25 mysql-bin.000005
-rw-rw---- 1 mysql mysql 120 Jun 2 13:28 mysql-bin.000006
-rw-rw---- 1 mysql mysql 205 Jun 2 15:10 mysql-bin.index
v-lhb-db03:/data01/mysqllog/binlog# cat mysql-bin.index
/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#
PURGE {MASTER | BINARY} LOGS TO 'log_name'
PURGE {MASTER | BINARY} LOGS BEFORE 'date'
Deletes all the binary logs listed in the log index prior to the
specified log or date. The logs also are removed from the list recorded
in the log index file, so that the given log becomes the first.
This statement has no effect if the --log-bin option has not been
enabled.
mysql清理binlog
转载本文章为转载内容,我们尊重原作者对文章享有的著作权。如有内容错误或侵权问题,欢迎原作者联系我们进行内容更正或删除文章。
提问和评论都可以,用心的回复会被更多人看到
评论
发布评论
相关文章
-
【Docker】Dcoker开启MySQL容器binlog日志
Dcoker开启MySQL容器binlog日志
mysql vim 日志文件 -
mysql binlog查看指定数据库
mysql binlog查看指定数据库的方法。
mysql 二进制日志 MySQL -
MySQL binlog日志清理
MySQL
mysql 最大连接数 连接数