{"id":62,"date":"2015-08-04T08:18:07","date_gmt":"2015-08-04T08:18:07","guid":{"rendered":"http:\/\/techliness.com\/?p=62"},"modified":"2017-01-13T08:41:57","modified_gmt":"2017-01-13T08:41:57","slug":"how-to-reduce-mysql-bin-files-on-the-fly","status":"publish","type":"post","link":"https:\/\/techliness.com\/?p=62","title":{"rendered":"How to Reduce mysql bin files on-the-fly"},"content":{"rendered":"<p>It is not unusual for bin file to fill up the partition for mysql when one is doing master-slave replication.<br \/>\nIdeally one should have a reasonable setting in the my.cnf file. Setting the expire_logs_days to something reasonable or the max_binlog_size to a size you one can leave with.<br \/>\nIn the case where one missed the opportunity to do so at the setup time and one cannot afford to change this and do a restart. two commands come in handy. One will reduce to the file desired and the other will reduce the bin files to the desired date.<br \/>\n<!--more--><\/p>\n<p><code>PURGE BINARY LOGS BEFORE '2015-08-03 23:00:00';<br \/>\nPURGE BINARY LOGS TO 'mysql-bin.03';<\/code><\/p>\n<p>These work immediately and results should show of course one case just use now() or something similar in the first case as opposed to typing in a date.<\/p>\n<p>As an example, you can purge bin logs older than three(3) days using the following<\/p>\n<p><code>PURGE BINARY LOGS BEFORE now() - interval 3 day;<\/code><\/p>\n","protected":false},"excerpt":{"rendered":"<p>It is not unusual for bin file to fill up the partition for mysql when one is doing master-slave replication. Ideally one should have a reasonable setting in the my.cnf file. Setting the expire_logs_days to something reasonable or the max_binlog_size to a size you one can leave with. In the case where one missed the &hellip; <a href=\"https:\/\/techliness.com\/?p=62\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;How to Reduce mysql bin files on-the-fly&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[3],"tags":[19,18],"_links":{"self":[{"href":"https:\/\/techliness.com\/index.php?rest_route=\/wp\/v2\/posts\/62"}],"collection":[{"href":"https:\/\/techliness.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/techliness.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/techliness.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/techliness.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=62"}],"version-history":[{"count":4,"href":"https:\/\/techliness.com\/index.php?rest_route=\/wp\/v2\/posts\/62\/revisions"}],"predecessor-version":[{"id":76,"href":"https:\/\/techliness.com\/index.php?rest_route=\/wp\/v2\/posts\/62\/revisions\/76"}],"wp:attachment":[{"href":"https:\/\/techliness.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=62"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/techliness.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=62"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/techliness.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=62"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}