<?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>My Learnings - Markish Personal Blog &#187; Automating MySQL Backup</title>
	<atom:link href="http://markish.in/tag/automating-mysql-backup/feed/" rel="self" type="application/rss+xml" />
	<link>http://markish.in</link>
	<description>It&#039;s my Blog....!</description>
	<lastBuildDate>Thu, 10 Mar 2011 08:41:51 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3</generator>
		<item>
		<title>Scheduling MySQL Backup..!</title>
		<link>http://markish.in/2008/09/scheduling-mysql-backup/</link>
		<comments>http://markish.in/2008/09/scheduling-mysql-backup/#comments</comments>
		<pubDate>Mon, 22 Sep 2008 19:12:30 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Database]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[Automating MySQL Backup]]></category>
		<category><![CDATA[Markish]]></category>
		<category><![CDATA[MySQL Backup]]></category>
		<category><![CDATA[Scheduling MySQL backup]]></category>

		<guid isPermaLink="false">http://markishonline.com/2008/09/23/scheduling-mysql-backup/</guid>
		<description><![CDATA[<p>    There have been instances when we need to schedule the backup process of MySQL databases regularly. So I thought of writing batch file that can be added in the Windows scheduler. I used the &#8216;mysqldump&#8217; utility that comes with the MySQL distributions. It dumps the database definition along with all the data, indexes, triggers [...]]]></description>
			<content:encoded><![CDATA[<p>    There have been instances when we need to schedule the backup process of MySQL databases regularly. So I thought of writing batch file that can be added in the Windows scheduler. I used the &#8216;mysqldump&#8217; utility that comes with the MySQL distributions. It dumps the database definition along with all the data, indexes, triggers and SPs in the form of .sql file. I&#8217;ve also made the batch file to compress the output .sql file.</p>
<p><span id="more-78"></span>The complete script can be configured by setting some variables in it. I&#8217;ll explain the configuration parameters below.</p>
<div style="text-align: center">
<table style="border-collapse:collapse" border="0">
<colgroup span="1">
<col style="width: 83px;" span="1"></col>
<col style="width: 162px;" span="1"></col>
<col style="width: 393px;" span="1"></col>
</colgroup>
<tbody>
<tr>
<td style="padding-left: 7px; padding-right: 7px; border-top:  solid black 0.5pt; border-left:  solid black 0.5pt; border-bottom:  solid black 0.5pt; border-right:  solid black 0.5pt"><strong>SN</strong></td>
<td style="padding-left: 7px; padding-right: 7px; border-top:  solid black 0.5pt; border-left:  none; border-bottom:  solid black 0.5pt; border-right:  solid black 0.5pt"><strong>Parameter</strong></td>
<td style="padding-left: 7px; padding-right: 7px; border-top:  solid black 0.5pt; border-left:  none; border-bottom:  solid black 0.5pt; border-right:  solid black 0.5pt"><strong>Comments</strong></td>
</tr>
<tr>
<td style="padding-left: 7px; padding-right: 7px; border-top:  none; border-left:  solid black 0.5pt; border-bottom:  solid black 0.5pt; border-right:  solid black 0.5pt">1</td>
<td style="padding-left: 7px; padding-right: 7px; border-top:  none; border-left:  none; border-bottom:  solid black 0.5pt; border-right:  solid black 0.5pt">backupdir</td>
<td style="padding-left: 7px; padding-right: 7px; border-top:  none; border-left:  none; border-bottom:  solid black 0.5pt; border-right:  solid black 0.5pt">Tell where you want to store the final archive. If the folder doesn&#8217;t exist, Please create it.</td>
</tr>
<tr>
<td style="padding-left: 7px; padding-right: 7px; border-top:  none; border-left:  solid black 0.5pt; border-bottom:  solid black 0.5pt; border-right:  solid black 0.5pt">2</td>
<td style="padding-left: 7px; padding-right: 7px; border-top:  none; border-left:  none; border-bottom:  solid black 0.5pt; border-right:  solid black 0.5pt">workdir</td>
<td style="padding-left: 7px; padding-right: 7px; border-top:  none; border-left:  none; border-bottom:  solid black 0.5pt; border-right:  solid black 0.5pt">Tell where your temporary .sql file will get generated.</td>
</tr>
<tr>
<td style="padding-left: 7px; padding-right: 7px; border-top:  none; border-left:  solid black 0.5pt; border-bottom:  solid black 0.5pt; border-right:  solid black 0.5pt">3</td>
<td style="padding-left: 7px; padding-right: 7px; border-top:  none; border-left:  none; border-bottom:  solid black 0.5pt; border-right:  solid black 0.5pt">mysqldir</td>
<td style="padding-left: 7px; padding-right: 7px; border-top:  none; border-left:  none; border-bottom:  solid black 0.5pt; border-right:  solid black 0.5pt">Tell where the mysqldump exe is available. Generally it resides in the bin folder of the MySQL distribution.</td>
</tr>
<tr>
<td style="padding-left: 7px; padding-right: 7px; border-top:  none; border-left:  solid black 0.5pt; border-bottom:  solid black 0.5pt; border-right:  solid black 0.5pt">4</td>
<td style="padding-left: 7px; padding-right: 7px; border-top:  none; border-left:  none; border-bottom:  solid black 0.5pt; border-right:  solid black 0.5pt">logdir</td>
<td style="padding-left: 7px; padding-right: 7px; border-top:  none; border-left:  none; border-bottom:  solid black 0.5pt; border-right:  solid black 0.5pt">Tell where you want to put the logfile. I&#8217;ve included a small logging mechanism with the script as well</td>
</tr>
<tr>
<td style="padding-left: 7px; padding-right: 7px; border-top:  none; border-left:  solid black 0.5pt; border-bottom:  solid black 0.5pt; border-right:  solid black 0.5pt">5</td>
<td style="padding-left: 7px; padding-right: 7px; border-top:  none; border-left:  none; border-bottom:  solid black 0.5pt; border-right:  solid black 0.5pt">zip_dir</td>
<td style="padding-left: 7px; padding-right: 7px; border-top:  none; border-left:  none; border-bottom:  solid black 0.5pt; border-right:  solid black 0.5pt">Tell where your compressing utility is. It can be either Winzip or Winrar or gzip or any compression utility.</td>
</tr>
<tr>
<td style="padding-left: 7px; padding-right: 7px; border-top:  none; border-left:  solid black 0.5pt; border-bottom:  solid black 0.5pt; border-right:  solid black 0.5pt">6</td>
<td style="padding-left: 7px; padding-right: 7px; border-top:  none; border-left:  none; border-bottom:  solid black 0.5pt; border-right:  solid black 0.5pt">Servername, database, mysqluser, mysqlpassword</td>
<td style="padding-left: 7px; padding-right: 7px; border-top:  none; border-left:  none; border-bottom:  solid black 0.5pt; border-right:  solid black 0.5pt">DB Specific settings. Configure it here. <span style="color: #ff0000;"><strong>Please note this is available to anyone who has the access to this batch file.</strong></span></td>
</tr>
</tbody>
</table>
</div>
<p> </p>
<p>    Once you have the configuration done. Open the Windows Scheduler (from control panel) add this batch file and schedule it with the interval you want. You are done. You have your backup process running. The same script can be modified slightly to handle multiple databases if you need. This script can be downloaded from <a href="http://www.markishonline.com/downloads/mysql_backup.zip">here</a></p>
<p>Do share your comments.</p>
]]></content:encoded>
			<wfw:commentRss>http://markish.in/2008/09/scheduling-mysql-backup/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

