mysql日誌清理

來源:互聯網
上載者:User

標籤:style   blog   color   os   檔案   資料   2014   for   

mysql bin-log 日誌清理


發現mysql資料庫目錄中bin-log中記錄檔非常大

[[email protected] var]# du -sh mysql-bin* | sort1020K   mysql-bin.0000021.1G    mysql-bin.0000211.1M    mysql-bin.000018136K    mysql-bin.000019172K    mysql-bin.000014191M    mysql-bin.000013224M    mysql-bin.00001728K     mysql-bin.0000013.5M    mysql-bin.0000124.0K    mysql-bin.0000034.0K    mysql-bin.0000044.0K    mysql-bin.0000054.0K    mysql-bin.0000064.0K    mysql-bin.0000074.0K    mysql-bin.0000154.0K    mysql-bin.0000164.0K    mysql-bin.index5.5M    mysql-bin.00001163M     mysql-bin.00000864K     mysql-bin.00000965M     mysql-bin.00002272K     mysql-bin.000010863M    mysql-bin.000020[[email protected] var]#登陸到mysql查看bin-logmysql> show binary logs;+------------------+------------+| Log_name         | File_size  |+------------------+------------+| mysql-bin.000001 |      27338 || mysql-bin.000002 |    1038693 || mysql-bin.000003 |       1272 || mysql-bin.000004 |        126 || mysql-bin.000005 |        126 || mysql-bin.000006 |        126 || mysql-bin.000007 |        126 || mysql-bin.000008 |   64950073 || mysql-bin.000009 |      57911 || mysql-bin.000010 |      69548 || mysql-bin.000011 |    5735460 || mysql-bin.000012 |    3564763 || mysql-bin.000013 |  199226556 || mysql-bin.000014 |     170872 || mysql-bin.000015 |        838 || mysql-bin.000016 |        126 || mysql-bin.000017 |  233747353 || mysql-bin.000018 |    1128493 || mysql-bin.000019 |     133652 || mysql-bin.000020 |  903932814 || mysql-bin.000021 | 1073745163 || mysql-bin.000022 |   67963674 |+------------------+------------+22 rows in set (0.00 sec)mysql> 

 


刪除2014-06-01 00:01:01 之前的日誌:

mysql> PURGE BINARY LOGS BEFORE ‘2014-06-01 00:01:01‘;   Query OK, 0 rows affected (0.21 sec)mysql> 

 



++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
保留最後一次bin-logs

mysql> PURGE BINARY LOGS TO ‘mysql-bin.000022‘;Query OK, 0 rows affected (0.60 sec)mysql>mysql>mysql>mysql>mysql>mysql> show binary logs;                  +------------------+-----------+| Log_name         | File_size |+------------------+-----------+| mysql-bin.000022 |  68830784 |+------------------+-----------+1 row in set (0.00 sec)mysql>

 






相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.