zoukankan      html  css  js  c++  java
  • mysql清理binlog日志

    mysql的binlog日志过多过大,清理过程。

    1.查看binlog日志

    mysql> show binary logs;
    +------------------+-----------+
    | Log_name         | File_size |
    +------------------+-----------+
    | mysql-bin.000001 |  13255920 |
    | mysql-bin.000002 |    143716 |
    | mysql-bin.000003 | 524288119 |
    | mysql-bin.000004 | 524288076 |
    | mysql-bin.000005 | 520461264 |
    | mysql-bin.000006 |   4768739 |
    | mysql-bin.000007 | 469726614 |
    | mysql-bin.000008 | 524291087 |
    | mysql-bin.000009 | 524288353 |
    | mysql-bin.000010 | 524289342 |
    | mysql-bin.000011 | 524288703 |
    | mysql-bin.000012 | 274820426 |
    +------------------+-----------+
    12 rows in set (0.00 sec)
    

    2.删除某个日志文件之前的所有日志文件

    mysql> purge binary logs to 'mysql-bin.000012';
    Query OK, 0 rows affected (0.59 sec)
    
    mysql> show binary logs;
    +------------------+-----------+
    | Log_name         | File_size |
    +------------------+-----------+
    | mysql-bin.000012 | 275418857 |
    +------------------+-----------+
    1 row in set (0.00 sec)
    

    3.重置日志

    mysql> reset master;
    Query OK, 0 rows affected (0.21 sec)
    
    mysql> show binary logs;
    +------------------+-----------+
    | Log_name         | File_size |
    +------------------+-----------+
    | mysql-bin.000001 |      5059 |
    +------------------+-----------+
    1 row in set (0.00 sec)
    

    注意,如果是主从复制,修改主后,slave上会报错,需要在slave重新设置同步。

    slave操作:

    mysql> stop salve;
    mysql>change master to master_host='192.168.100.10',master_user='rep',master_password='123456', master_log_file='mysql-bin.000001',master_log_pos=5059;
    mysql> show slave statusG;
  • 相关阅读:
    SAP 锁对象
    smartforms取消word为默认编辑器
    abap 配置 zconfig
    Ant步步为营(1)解压本地的zip包
    点击页面出现文字动画
    js简单实现累加
    github发布线上项目
    jsonp的实现
    js操作class
    js开发实用技巧
  • 原文地址:https://www.cnblogs.com/xzlive/p/9963353.html
Copyright © 2011-2022 走看看