<?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>No Znx! &#187; backup</title>
	<atom:link href="http://znx.no/tag/backup/feed/" rel="self" type="application/rss+xml" />
	<link>http://znx.no</link>
	<description>the pigeons!!!!</description>
	<lastBuildDate>Tue, 20 Dec 2011 22:42:26 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	
		<item>
		<title>Backing Up MySQL Databases</title>
		<link>http://znx.no/2009/01/backing-up-mysql-databases/</link>
		<comments>http://znx.no/2009/01/backing-up-mysql-databases/#comments</comments>
		<pubDate>Tue, 27 Jan 2009 22:47:49 +0000</pubDate>
		<dc:creator>znx</dc:creator>
				<category><![CDATA[Scripts]]></category>
		<category><![CDATA[backup]]></category>
		<category><![CDATA[mysql]]></category>

		<guid isPermaLink="false">http://znx.no/?p=73</guid>
		<description><![CDATA[This is a really simple script that can be used to backup all the databases in a MySQL server. Thought I&#8217;d put it here as it shows some basic scripting techniques that maybe will help people see how to write scripts. Basically all this does is save me from having to type out the date. [...]]]></description>
			<content:encoded><![CDATA[<p>This is a really simple script that can be used to backup all the databases in a MySQL server. Thought I&#8217;d put it here as it shows some basic scripting techniques that maybe will help people see how to write scripts. Basically all this does is save me from having to type out the date. It could be automated but that would require storing the user name and password somewhere which normally isn&#8217;t too smart an idea.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/bin/sh</span>
<span style="color: #666666; font-style: italic;"># GNU GPL version 3.0 or above</span>
<span style="color: #666666; font-style: italic;"># Copyright (c) 2009 Mark Sangster</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #660033;">-z</span> <span style="color: #ff0000;">&quot;$3&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span>
  <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">'mybackup &lt;user&gt; &lt;password&gt; &lt;host&gt;'</span> <span style="color: #000000; font-weight: bold;">&gt;&amp;</span><span style="color: #000000;">2</span>
  <span style="color: #7a0874; font-weight: bold;">exit</span> <span style="color: #000000;">1</span>
<span style="color: #000000; font-weight: bold;">fi</span>
&nbsp;
<span style="color: #007800;">MYUSER</span>=<span style="color: #007800;">$1</span>; <span style="color: #007800;">MYPASS</span>=<span style="color: #007800;">$2</span>; <span style="color: #007800;">MYHOST</span>=<span style="color: #007800;">$3</span>
&nbsp;
mysqldump <span style="color: #660033;">-u</span> <span style="color: #007800;">$MYUSER</span> <span style="color: #660033;">-p</span> <span style="color: #007800;">$MYPASS</span> <span style="color: #660033;">-h</span> <span style="color: #007800;">$MYHOST</span> <span style="color: #660033;">-A</span> <span style="color: #000000; font-weight: bold;">|</span> \
  <span style="color: #c20cb9; font-weight: bold;">bzip2</span> <span style="color: #660033;">-9</span> <span style="color: #000000; font-weight: bold;">&gt;</span> mysql-<span style="color: #000000; font-weight: bold;">`</span><span style="color: #c20cb9; font-weight: bold;">date</span> +<span style="color: #000000; font-weight: bold;">%</span>Y-<span style="color: #000000; font-weight: bold;">%</span>m-<span style="color: #000000; font-weight: bold;">%</span>d<span style="color: #000000; font-weight: bold;">`</span>.bz2</pre></div></div>

<p>The script usage is very striaght-forward:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># mybackup user pass host</span></pre></div></div>

<p>At which point you will find a file called &#8220;mysql-2009-01-27.bz2&#8243; or similar.  Nothing to difficult!</p>
]]></content:encoded>
			<wfw:commentRss>http://znx.no/2009/01/backing-up-mysql-databases/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

