<?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>Blog by Andreas Glaser &#187; Python</title>
	<atom:link href="http://www.andreas-glaser.com/category/development/python/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.andreas-glaser.com</link>
	<description>Development, Technology and such...</description>
	<lastBuildDate>Wed, 18 May 2011 23:16:12 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>(Python) Mysqldump Backup 1.1</title>
		<link>http://www.andreas-glaser.com/2010/04/12/python-mysqldump-backup-1-1/</link>
		<comments>http://www.andreas-glaser.com/2010/04/12/python-mysqldump-backup-1-1/#comments</comments>
		<pubDate>Mon, 12 Apr 2010 08:00:02 +0000</pubDate>
		<dc:creator>Andreas Glaser</dc:creator>
				<category><![CDATA[Computer]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Operating system]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[Backup]]></category>
		<category><![CDATA[Mysql]]></category>
		<category><![CDATA[Script]]></category>
		<category><![CDATA[Security]]></category>

		<guid isPermaLink="false">http://www.andreas-glaser.com/?p=326</guid>
		<description><![CDATA[Backups are crucial! Since that is fact I wrote a little script in Python to easily backup mysql databases on a linux server. How do i configure it? After you downloaded the script to your Linux server you will need a few Linux packages. Execute the following commands as root: apt-get update apt-get install python [...]]]></description>
			<content:encoded><![CDATA[<p>Backups are crucial!<br />
Since that is fact I wrote a little script in Python to easily backup mysql databases on a linux server.</p>
Note: There is a file embedded within this post, please visit this post to download the file.
<p><strong><br />
How do i configure it?<br />
</strong>After you downloaded the script to your Linux server you will need a few Linux packages. Execute the following commands as root:</p>
<blockquote><p><em>apt-get update<br />
apt-get install python mysqldump bzip2</em></p></blockquote>
<p><strong>What does it do?</strong><br />
This script dumps a certain database (or all databases) into a single mysql file, which is zipped (bzip2) afterwards.</p>
<p>Now edit the script with your preferred editor.</p>
<blockquote><p><em>vim mysqldump-backup.py</em></p></blockquote>
<p><strong>Customize the following lines:</strong></p>
<blockquote><p># 2. Config<br />
mysqlUser = &#8220;root&#8221;<br />
mysqlPwd = &#8220;YOUR_PASSWORD&#8221;<br />
mysqlDatabase = &#8220;&#8211;all-databases&#8221;<br />
dumpDir = &#8220;/tmp/&#8221;<br />
dumpFile = &#8220;mysqldump-&#8221; + strftime(&#8220;%Y-%m-%d-%H-%M-%S&#8221;, gmtime()) + &#8220;.sql&#8221;</p></blockquote>
<p>The last step is to make the script executable:</p>
<blockquote><p><em>chmod u +x mysqldump-backup-1.1.py</em></p></blockquote>
<p>Thats it!</p>
<p>You can now run the script:</p>
<blockquote><p><em>/path/to/the/script/mysqldump-backup-1.1.py</em></p></blockquote>
<p><strong>To run it daily (crontab):</strong></p>
<blockquote><p><em>crontab -e</em></p></blockquote>
<p>Add at the bottom:</p>
<blockquote><p>0 3 * * * <em>/path/to/the/script/mysqldump-backup.py</em></p></blockquote>
<p>Now your databases will be backupped daily at 03:00 am</p>
<p><strong>Download</strong></p>
Note: There is a file embedded within this post, please visit this post to download the file.
<p><strong>Changelog</strong><br />
1.1</p>
<ul>
<li>Removed trailing semicolons</li>
<li>Renamed variables</li>
</ul>
<p>1.0 </p>
<ul>
<li>Initial release</li>
</ul>
<p>Have fun!<br />
Andreas Glaser aka JaZz</p>
<fb:like href='http://www.andreas-glaser.com/2010/04/12/python-mysqldump-backup-1-1/' send='' layout='standard' show_faces='true' width='450' height='65' action='like' colorscheme='light' font='lucida+grande'></fb:like>]]></content:encoded>
			<wfw:commentRss>http://www.andreas-glaser.com/2010/04/12/python-mysqldump-backup-1-1/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
	</channel>
</rss>

