<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Hack Admin &#187; binary logs</title>
	<atom:link href="http://www.hackadmin.com/tag/binary-logs/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.hackadmin.com</link>
	<description></description>
	<lastBuildDate>Tue, 16 Mar 2010 21:31:57 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Getting Rid Of MySQL Binary Logs</title>
		<link>http://www.hackadmin.com/2009/06/25/getting-rid-of-mysql-binary-logs/</link>
		<comments>http://www.hackadmin.com/2009/06/25/getting-rid-of-mysql-binary-logs/#comments</comments>
		<pubDate>Thu, 25 Jun 2009 22:10:23 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Database]]></category>
		<category><![CDATA[Maintenance]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[binary]]></category>
		<category><![CDATA[binary logs]]></category>
		<category><![CDATA[logs]]></category>
		<category><![CDATA[master]]></category>
		<category><![CDATA[mysql master]]></category>
		<category><![CDATA[MySql Slave]]></category>
		<category><![CDATA[slave]]></category>

		<guid isPermaLink="false">http://www.hackadmin.com/?p=96</guid>
		<description><![CDATA[If you&#8217;re in charge of a mysql database that does any sort of volume, you might find yourself in the peculiar situation where your binary logs have piled up to an unmanageble level.  Typically you&#8217;ll use the binary logs for replication from a master server to a slave.  This may not always be the case [...]]]></description>
			<content:encoded><![CDATA[<p>If you&#8217;re in charge of a mysql database that does any sort of volume, you might find yourself in the peculiar situation where your binary logs have piled up to an unmanageble level.  Typically you&#8217;ll use the binary logs for replication from a master server to a slave.  This may not always be the case though.  The bottom line is, if you have binary logging enabled in your my.cnf you&#8217;ll be producing and stockpiling binlogs.</p>
<p><span id="more-96"></span><br />
When you first realize that you have a problem, you&#8217;ll have a gut reaction to just delete these files, and to be quite honest, I&#8217;m not sure if that really *breaks* anything or not.  MySQL does track these files though.  So it&#8217;s possible if you yank a file out from under the server, it might get a little whacky.   The bottom line is though, they are merely a binary representation of the sql that you intend to send to another server (typically), and they have nothing to do with the integrity of the data in the database.</p>
<p>So if you want to do it the *correct* way, mysql has a command set to deal with these logs.  First, to get a look at the files and their sizes, you can do a <strong><em>show binary logs</em></strong> . This will give you the breakdown of all the bin logs the server knows about.</p>
<p>It may be prudent, if you are running in a master/slave environment to take a look at your slave status so that you know you are not behind.  basically, log into your slave and run <em><strong>show slave status\G</strong></em> . Make sure that Slave_IO_Running: Yes and Slave_SQL_Running: Yes exist, and check Seconds_Behind_Master: 0.   These 3 things will tell you that your slave is running and up to date.  While you&#8217;re here, make note of the Master_Log_File: .   This should be the most recent log listed in your <em><strong>show binary logs</strong></em> output on the master server.</p>
<p>Now that you know where you are in your binary log world, all you need to do is tell the master to purge the files up to the next to the last file, or less if you&#8217;re paranoid.  If you&#8217;re most recent log file is mysql-bin.104 then you might want to issue the following command:  <em><strong>PURGE BINARY LOGS TO &#8216;mysql-bin.103&#8242;</strong></em>.  This will leave log 103 and 104 on the server and remove the rest.</p>
<p>That&#8217;s about it, Happy Purging!!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.hackadmin.com/2009/06/25/getting-rid-of-mysql-binary-logs/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
