<?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>ASP.NET MSSQL Webhosting Blog &#187; asp</title>
	<atom:link href="http://www.mywebhostingblog.net/tag/asp/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.mywebhostingblog.net</link>
	<description>ASP.NET, MSSQL and Windows dedicated server articles</description>
	<lastBuildDate>Thu, 16 Sep 2010 19:53:40 +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>Backup MySQL using VBS scripts</title>
		<link>http://www.mywebhostingblog.net/aspnet-web-hosting/backup-mysql-using-vbs-scripts/</link>
		<comments>http://www.mywebhostingblog.net/aspnet-web-hosting/backup-mysql-using-vbs-scripts/#comments</comments>
		<pubDate>Mon, 12 Jan 2009 16:13:26 +0000</pubDate>
		<dc:creator>Martin</dc:creator>
				<category><![CDATA[ASP.NET Web Hosting]]></category>
		<category><![CDATA[MySQL Hosting]]></category>
		<category><![CDATA[Window Hosting]]></category>
		<category><![CDATA[asp]]></category>
		<category><![CDATA[ASP .NET]]></category>
		<category><![CDATA[Backup]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[Windows]]></category>

		<guid isPermaLink="false">http://www.mywebhostingblog.net/?p=441</guid>
		<description><![CDATA[I have seen so many people searching ASP or ASP .NET scripts to backup their MySQL databases. Not only this but my Blog has been getting to many hits for the search term &#8220;backup mysql asp&#8221;. After seeing the need of so many people for the script I decided to write a VBS script to [...]]]></description>
			<content:encoded><![CDATA[<p>I have seen so many people searching <strong>ASP </strong>or <strong>ASP .NET</strong> scripts to backup their <strong>MySQL databases</strong>. Not only this but my <strong>Blog </strong>has been getting to many hits for the search term <em><strong>&#8220;backup mysql asp&#8221;</strong></em>. After seeing the need of so many people for the script I decided to write a VBS script to backup all or single <strong>MySQL database</strong> on <strong>Windows</strong> <strong>server</strong>. I am not very good at <strong>ASP </strong>so I didn&#8217;t write the script in ASP or<strong> ASP .NET</strong> but one can convert this script in either <strong>ASP </strong>or <strong>ASP .NET</strong>, it should not be a huge problem I suppose.</p>
<p style="text-align: center;"><img class="size-full wp-image-443 aligncenter" title="backup mysql VBS" src="http://www.mywebhostingblog.net/wp-content/uploads/2009/03/backup-mysql-asp.jpg" alt="backup-mysql-asp" width="259" height="92" /><span id="more-441"></span></p>
<p style="text-align: center;"><img class="aligncenter size-full wp-image-442" title="backup-mysql-asp-1" src="http://www.mywebhostingblog.net/wp-content/uploads/2009/03/backup-mysql-asp-1.jpg" alt="backup-mysql-asp-1" width="278" height="121" /></p>
<p>Please make sure of the following before you configure the script:</p>
<ul>
<li>The user that is running the script must have execute permissions on <code>cscript</code> in system32</li>
<li>The user that is running the script must have write permissions folder that is going to store the backup file.</li>
<li>The user that is running the script must have execute permissions on <code>mysqldump.exe</code> in Mysqlbin</li>
<li>If you running this script in browser then your web user will need the above permissions.</li>
</ul>
<p>So here is the script:</p>
<p><em><strong>backup-mysql-database.vbs</strong></em></p>
<p><code>Option Explicit<br />
Dim backup_dir, num_days, user, password, database, arguments, backup_file<br />
Dim oShell, oFS, oDrive, nResults, sqldump</code></p>
<p><code>backup_dir = "C:MysqlBackups"<br />
user = "xxxxxxxx"<br />
password = "yyyyyyyy"<br />
database = "zzzzzzzz"<br />
sqldump = "C:Mysqlbinmysqldump.exe"</code></p>
<p><code>backup_file = backup_dir &amp; database &amp; ".sql"<br />
arguments = "--user=" &amp; user &amp; " --password=" &amp; password &amp; " " &amp; database &amp; " &gt; " &amp; backup_file<br />
arguments = sqldump &amp; " " &amp; arguments<br />
WScript.Echo(arguments1)<br />
</code><br />
<code>Set oShell = CreateObject("WScript.Shell")</code></p>
<p><code>WScript.Echo("Creating backup file " &amp; backup_file)<br />
nResults = oShell.Run ("cmd /C" &amp; arguments, 1, TRUE)<br />
WScript.Echo(nResults)</code></p>
<p><code>Set oShell = Nothing</code></p>
<p>The following variable will be needed to be defined as per your need:</p>
<p><em><strong>backup_dir </strong></em>= Should have the path to the directory that you want to save you backup file in.<br />
<em><strong>user</strong></em> = Database user name that has full privileges over the <strong>database </strong>you want to backup.<br />
<em><strong>password</strong></em> = <strong>Password </strong>of the database user.<br />
<em><strong>database</strong></em> = Name of the database that you want to backup<br />
<em><strong>sqldump </strong></em>= Path to mysqldump.exe, normally this is stored in <strong>MySQLbin</strong> directory.</p>
<p>To backup all database you can ignore the database variable and replace the first argument command with:<br />
<code><br />
arguments = "--user=" &amp; user &amp; " --password=" &amp; password &amp; " --all-databases --quick<br />
--result-file=" &amp; backup_file</code></p>
<p>Now you can run the command below to execute the script on Windows server:</p>
<p><code>cscript c:myscriptsbackup-mysql-database.vbs</code></p>
<p>You can also <strong>schedule </strong>the above command to run on sceduled timining to backup the <strong>MySQL databases.</strong></p>
]]></content:encoded>
			<wfw:commentRss>http://www.mywebhostingblog.net/aspnet-web-hosting/backup-mysql-using-vbs-scripts/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>

