<?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>Just answer the F*#king question &#187; MySQL</title>
	<atom:link href="http://www.jatfq.com/archives/category/mysql/feed" rel="self" type="application/rss+xml" />
	<link>http://www.jatfq.com</link>
	<description></description>
	<lastBuildDate>Fri, 06 Aug 2010 13:05:50 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>mySQL backup script</title>
		<link>http://www.jatfq.com/archives/103</link>
		<comments>http://www.jatfq.com/archives/103#comments</comments>
		<pubDate>Mon, 16 Nov 2009 14:31:59 +0000</pubDate>
		<dc:creator>Sime</dc:creator>
				<category><![CDATA[MySQL]]></category>

		<guid isPermaLink="false">http://www.jatfq.com/?p=103</guid>
		<description><![CDATA[This backup is listed on the mySQL site somewhere. Backs up a DB broken down into individual tables. Great if you have large data sets. This one also purges the files after 7 days ( does leave the directories behind though ) #setup suffix=`date +%Y%m%d` dest=/mirror/mysql/SQL01 cmd='/usr/bin/mysqldump' databases=(`echo 'show databases;' &#124; mysql -h SQL01 -u [...]]]></description>
			<content:encoded><![CDATA[<p>This backup is listed on the mySQL site somewhere. Backs up a DB broken down into individual tables. Great if you have large data sets. This one also purges the files after 7 days ( does leave the directories behind though )</p>
<p><code>#setup<br />
suffix=`date +%Y%m%d`<br />
dest=/mirror/mysql/SQL01<br />
cmd='/usr/bin/mysqldump'</p>
<p>databases=(`echo 'show databases;' | mysql -h SQL01 -u root | grep -v ^Database$`)</p>
<p>for d in "${databases[@]}"; do<br />
if [[ $d != 'tmp' &#038;&#038; $d != 'test' ]]<br />
then<br />
echo "DATABASE ${d}"<br />
s="use ${d}; show tables;"<br />
tables=(`echo ${s} | mysql -h SQL01 -u root | grep -v '^Tables_in_'`)<br />
for t in "${tables[@]}"; do<br />
if [[ $t != 'tbl_parameter' &#038;&#038; $t != 'tbl_session' ]]<br />
then<br />
echo " TABLE ${t}"<br />
path="${dest}/${suffix}/${d}"<br />
mkdir -p ${path}<br />
${cmd} --user=root --host SQL01 --quick --add-drop-table --all ${d} ${t} | bzip2 -c > ${path}/${t}.sql.bz2<br />
fi<br />
done<br />
fi<br />
done</p>
<p># delete old dumps (retain 5 days)<br />
find ${dest} -mtime +10 -exec rm {} \;</p>
<p>find /mirror -depth -type d -empty -print0 |xargs -0 rmdir</code></p>

<span class="slashdigglicious">
<a href="http://slashdot.org/bookmark.pl?url=http%3A%2F%2Fwww.jatfq.com%2Farchives%2F103&amp;title=mySQL+backup+script" title="Slashdot It!"><img src="http://slashdot.org/favicon.ico" height="16" width="16" alt="[Slashdot]" /></a>
<a href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.jatfq.com%2Farchives%2F103&amp;title=mySQL+backup+script" title="Digg This Story"><img src="http://digg.com/favicon.ico" width="16" height="16" alt="[Digg]" /></a>
<a href="http://reddit.com/submit?url=http%3A%2F%2Fwww.jatfq.com%2Farchives%2F103&amp;title=mySQL+backup+script" title="Reddit"><img src="http://reddit.com/favicon.ico" width="16" height="16" alt="[Reddit]" /></a>
<a href="http://del.icio.us/post?url=http%3A%2F%2Fwww.jatfq.com%2Farchives%2F103&amp;title=mySQL+backup+script" title="Save to del.icio.us" onclick="window.open('http://del.icio.us/post?v=4&amp;noui&amp;jump=close&amp;url=http%3A%2F%2Fwww.jatfq.com%2Farchives%2F103&amp;title=mySQL+backup+script', 'delicious', 'toolbar=no,width=700,height=400'); return false;"><img src="http://images.del.icio.us/static/img/delicious.small.gif" width="16" height="16" alt="[del.icio.us]" /></a>
<a href="http://www.facebook.com/share.php?u=http%3A%2F%2Fwww.jatfq.com%2Farchives%2F103" title="Share on Facebook"><img src="http://www.facebook.com/favicon.ico" width="16" height="16" alt="[Facebook]" /></a>
<a href="http://technorati.com/faves?add=http%3A%2F%2Fwww.jatfq.com%2Farchives%2F103" title="Add to my Technorati Favorites"><img src="http://technorati.com/favicon.ico" width="16" height="16" alt="[Technorati]" /></a>
<a href="http://www.google.com/bookmarks/mark?op=edit&amp;output=popup&amp;bkmk=http%3A%2F%2Fwww.jatfq.com%2Farchives%2F103&amp;title=mySQL+backup+script" title="Save to Google Bookmarks"><img src="http://www.google.com/favicon.ico" width="16" height="16" alt="[Google]" /></a>
<a href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.jatfq.com%2Farchives%2F103&amp;title=mySQL+backup+script" title="Stumble it!"><img src="http://www.stumbleupon.com/favicon.ico" width="16" height="16" alt="[StumbleUpon]" /></a>
</span>]]></content:encoded>
			<wfw:commentRss>http://www.jatfq.com/archives/103/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Select random date</title>
		<link>http://www.jatfq.com/archives/99</link>
		<comments>http://www.jatfq.com/archives/99#comments</comments>
		<pubDate>Fri, 30 Oct 2009 12:56:12 +0000</pubDate>
		<dc:creator>Sime</dc:creator>
				<category><![CDATA[MySQL]]></category>

		<guid isPermaLink="false">http://www.jatfq.com/archives/99</guid>
		<description><![CDATA[I use this for insert records into a queue. To avoid overload one day, just split the records up over a number of days &#8230;. now() + INTERVAL rand()*2 day + INTERVAL 2 hour]]></description>
			<content:encoded><![CDATA[<p>I use this for insert records into a queue. To avoid overload one day, just split the records up over a number of days &#8230;.</p>
<p><code>now() + INTERVAL rand()*2 day + INTERVAL 2 hour</code></p>

<span class="slashdigglicious">
<a href="http://slashdot.org/bookmark.pl?url=http%3A%2F%2Fwww.jatfq.com%2Farchives%2F99&amp;title=Select+random+date" title="Slashdot It!"><img src="http://slashdot.org/favicon.ico" height="16" width="16" alt="[Slashdot]" /></a>
<a href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.jatfq.com%2Farchives%2F99&amp;title=Select+random+date" title="Digg This Story"><img src="http://digg.com/favicon.ico" width="16" height="16" alt="[Digg]" /></a>
<a href="http://reddit.com/submit?url=http%3A%2F%2Fwww.jatfq.com%2Farchives%2F99&amp;title=Select+random+date" title="Reddit"><img src="http://reddit.com/favicon.ico" width="16" height="16" alt="[Reddit]" /></a>
<a href="http://del.icio.us/post?url=http%3A%2F%2Fwww.jatfq.com%2Farchives%2F99&amp;title=Select+random+date" title="Save to del.icio.us" onclick="window.open('http://del.icio.us/post?v=4&amp;noui&amp;jump=close&amp;url=http%3A%2F%2Fwww.jatfq.com%2Farchives%2F99&amp;title=Select+random+date', 'delicious', 'toolbar=no,width=700,height=400'); return false;"><img src="http://images.del.icio.us/static/img/delicious.small.gif" width="16" height="16" alt="[del.icio.us]" /></a>
<a href="http://www.facebook.com/share.php?u=http%3A%2F%2Fwww.jatfq.com%2Farchives%2F99" title="Share on Facebook"><img src="http://www.facebook.com/favicon.ico" width="16" height="16" alt="[Facebook]" /></a>
<a href="http://technorati.com/faves?add=http%3A%2F%2Fwww.jatfq.com%2Farchives%2F99" title="Add to my Technorati Favorites"><img src="http://technorati.com/favicon.ico" width="16" height="16" alt="[Technorati]" /></a>
<a href="http://www.google.com/bookmarks/mark?op=edit&amp;output=popup&amp;bkmk=http%3A%2F%2Fwww.jatfq.com%2Farchives%2F99&amp;title=Select+random+date" title="Save to Google Bookmarks"><img src="http://www.google.com/favicon.ico" width="16" height="16" alt="[Google]" /></a>
<a href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.jatfq.com%2Farchives%2F99&amp;title=Select+random+date" title="Stumble it!"><img src="http://www.stumbleupon.com/favicon.ico" width="16" height="16" alt="[StumbleUpon]" /></a>
</span>]]></content:encoded>
			<wfw:commentRss>http://www.jatfq.com/archives/99/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
