删除MySQL二进制日志(log-bin)
2019/10/10/17:34:36 阅读:2022 来源:谷歌SEO算法 标签:
Google
本文章来告诉大怎么在mysql命令模式下载删除 MySQL 二进制日志(log-bin)的方法,有需要的朋友可参考.
查找当前有哪些二进制日志文件,代码如下:
- mysql>showbinarylogs;
- +------------------+-----------+
- |Log_name|File_size|
- +------------------+-----------+
- |mysql-bin.000001|1357315|
- |mysql-bin.000002|117|
- |mysql-bin.000003|404002|
- |mysql-bin.000004|2050722|
- |mysql-bin.000005|139103|
- |mysql-bin.000006|46702|
- |mysql-bin.000007|117|
- |mysql-bin.000008|98|
- |mysql-bin.000009|117|
- |mysql-bin.000010|1254|
- |mysql-bin.000011|117|
- |mysql-bin.000012|29394942|
- |mysql-bin.000013|422100|
- |mysql-bin.000014|117|
- |mysql-bin.000015|117|
- |mysql-bin.000016|98|
- |mysql-bin.000017|117|
- |mysql-bin.000018|117|
- |mysql-bin.000019|285300|
- |mysql-bin.000020|181229|
- |mysql-bin.000021|98|
- +------------------+-----------+
- 21rowsinset(0.03sec)
删除bin-log(删除mysql-bin.000018之前的所有二进制日志文件),代码如下:
- mysql>purgebinarylogsto'mysql-bin.000018';
- QueryOK,0rowsaffected(0.08sec)
- --phpfensi.com
- mysql>showbinarylogs;
- +------------------+-----------+
- |Log_name|File_size|
- +------------------+-----------+
- |mysql-bin.000018|117|
- |mysql-bin.000019|285300|
- |mysql-bin.000020|181229|
- |mysql-bin.000021|98|
- +------------------+-----------+
- 4rowsinset(0.00sec)
查看日志,代码如下:
- mysql>showbinlogevents;
- +------------------+-----+-------------+-----------+-------------+---------------------------------------+
- |Log_name|Pos|Event_type|Server_id|End_log_pos|Info|
- +------------------+-----+-------------+-----------+-------------+---------------------------------------+
- |mysql-bin.000018|4|Format_desc|1|98|Serverver:5.0.45-log,Binlogver:4|
- |mysql-bin.000018|98|Stop|1|117||
- +------------------+-----+-------------+-----------+-------------+---------------------------------------+
- 2rowsinset(0.01sec)
热门评论