您的位置:首页 > 数据库 > MySQL

清理bin-log日志(mysql-bin日志清理)

2014-10-27 11:24 274 查看
清理bin-log日志(mysql-bin日志清理),主从复制中的机器不要使用此方法。

1.查看档案

mysql> show binary logs;

+----------------+-----------+

| Log_name | File_size |

+----------------+-----------+

| ablelee.000001 | 150462942 |

| ablelee.000002 | 125 |

| ablelee.000003 | 106 |

+----------------+-----------+

2.删除bin-log(删除ablelee.000003之前的而没有包含ablelee.000003)

mysql> purge binary logs to 'ablelee.000003';

Query OK, 0 rows affected (0.16 sec)

3. 查询结果(现在只有一条记录了.)

mysql> show binlog events\G

*************************** 1. row ***************************

Log_name: ablelee.000003

Pos: 4

Event_type: Format_desc

Server_id: 1

End_log_pos: 106

Info: Server ver: 5.1.26-rc-log, Binlog ver: 4

1 row in set (0.01 sec)

(ablelee.000001和ablelee.000002已被删除)

mysql> show binary logs;

+----------------+-----------+

| Log_name | File_size |

+----------------+-----------+

| ablelee.000003 | 106 |

+----------------+-----------+

1 row in set (0.00 sec)
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: