<?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>thecrumb.com &#187; mysql</title>
	<atom:link href="http://thecrumb.com/tag/mysql/feed/" rel="self" type="application/rss+xml" />
	<link>http://thecrumb.com</link>
	<description>developer &#124; thinker &#124; tinkerer</description>
	<lastBuildDate>Sat, 04 Feb 2012 01:28:22 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Ant Meets MySQL</title>
		<link>http://thecrumb.com/2010/11/12/ant-meets-mysql/</link>
		<comments>http://thecrumb.com/2010/11/12/ant-meets-mysql/#comments</comments>
		<pubDate>Fri, 12 Nov 2010 14:18:59 +0000</pubDate>
		<dc:creator>Jim Priest</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Ant]]></category>
		<category><![CDATA[mysql]]></category>

		<guid isPermaLink="false">http://thecrumb.com/?p=1236</guid>
		<description><![CDATA[At my new job I&#8217;ve been using MySQL. When it got around to moving data around between servers and restoring my development database I looked at my existing scripts but they were all Oracle centric. I then looked to the &#8230; <a href="http://thecrumb.com/2010/11/12/ant-meets-mysql/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>At my new job I&#8217;ve been using MySQL. When it got around to moving data around between servers and restoring my development database I looked at my existing scripts but they were all Oracle centric.</p>
<p>I then looked to the <a title="Ant Wiki" href="http://thecrumb.com/wiki/ant">Ant wiki</a> and much to my surprise there were no MySQL specific entries!</p>
<p>After a bit of Googling and tinkering however I&#8217;ve come up with a script that does simple dump/restore functions and should provide the basics for someone to expand on if they need more.</p>
<p>The script is available on my wiki: <a title="MySQL Ant Script" href="http://thecrumb.com/wiki/ant/database">http://thecrumb.com/wiki/ant/database</a></p>
<p>One interesting thing I ran into that had me stumped for an afternoon was defining my user/password as properties and passing them into my script.</p>
<p>I usually define all my properties in external files.  In this example I had the following defined:</p>
<ul>
<li><em><strong>db.local.username </strong>= myusername</em></li>
<li><em><strong>db.local.password</strong> = password</em></li>
</ul>
<p>And was using it like:</p>
<pre class="brush: xml; title: ; notranslate">

&lt;exec executable=&quot;${path.mysql}/mysqldump&quot; input=&quot;dbscripts/@{filename}&quot;&gt;
&lt;arg value=&quot;--user=${db.@{server}.username}&quot;/&gt;
&lt;arg value=&quot;--password=${db.@{server}.password}&quot;/&gt;
&lt;arg value=&quot;--host=${db.@{server}}&quot;/&gt;
&lt;arg value=&quot;--port=3306&quot;/&gt;
&lt;arg value=&quot;@{database}&quot;/&gt;
&lt;/exec&gt;
</pre>
<p>When I ran this it bombed and I got a MySQL error.  I initially thought it was a MySQL permission error so I tested it via the command line and everything worked.</p>
<p>OK.</p>
<p>Then I swapped out the property values in my Ant script with hard coded values:</p>
<pre class="brush: xml; title: ; notranslate">
&lt;exec executable=&quot;${path.mysql}/mysqldump&quot; input=&quot;dbscripts/@{filename}&quot;&gt;
&lt;arg value=&quot;--user=root&quot;/&gt;
&lt;arg value=&quot;--password=password&quot;/&gt;
&lt;arg value=&quot;--host=${db.@{server}}&quot;/&gt;
&lt;arg value=&quot;--port=3306&quot;/&gt;
&lt;arg value=&quot;@{database}&quot;/&gt;
&lt;/exec&gt;
</pre>
<p>I expected that to fail as well but it worked!  Weird.  I then tried all sorts of various combinations.  Eventually I tried using property names that did NOT include &#8216;<em>username</em>&#8216; and &#8216;<em>password</em>&#8216;.</p>
<ul>
<li><em><strong>db.local.un</strong> = myusername</em></li>
<li><em><strong>db.local.pw</strong> = mypassword</em></li>
</ul>
<pre class="brush: xml; title: ; notranslate">

&lt;exec executable=&quot;${path.mysql}/mysqldump&quot; input=&quot;dbscripts/@{filename}&quot;&gt;
&lt;arg value=&quot;--user=${&lt;strong&gt;db.@{server}.un&lt;/strong&gt;}&quot;/&gt;
&lt;arg value=&quot;--password=${&lt;strong&gt;db.@{server}.pw&lt;/strong&gt;}&quot;/&gt;
&lt;arg value=&quot;--host=${db.@{server}}&quot;/&gt;
&lt;arg value=&quot;--port=3306&quot;/&gt;
&lt;arg value=&quot;@{database}&quot;/&gt;
&lt;/exec&gt;
</pre>
<p>And that worked! Even when defined in an external property file.</p>
<p>I have no idea if &#8216;<em>username</em>&#8216; and &#8216;<em>password</em>&#8216; are some sort of reserved word.  I tried it in both Ant 1.7 and  1.8 with the same results.</p>
<p>The scripts on the wiki work in my environment  (Ant 1.7, Windows XP and MySQL 5.1.x) .</p>
<p>If you modify the scripts and do something interesting with them &#8211; please let me know!</p>
<p>And if you blow something up &#8211; <em>please don&#8217;t blame me</em>!</p>
]]></content:encoded>
			<wfw:commentRss>http://thecrumb.com/2010/11/12/ant-meets-mysql/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Sun Buys MySQL!</title>
		<link>http://thecrumb.com/2008/01/16/sun-buys-mysql/</link>
		<comments>http://thecrumb.com/2008/01/16/sun-buys-mysql/#comments</comments>
		<pubDate>Wed, 16 Jan 2008 13:33:30 +0000</pubDate>
		<dc:creator>Jim Priest</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[mysql]]></category>

		<guid isPermaLink="false">http://www.thecrumb.com/2008/01/16/sun-buys-mysql/</guid>
		<description><![CDATA[Wow. Didn&#8217;t see that one coming. Today Sun announced they are acquiring MySQL! Not many details yet but&#8230; wow.]]></description>
			<content:encoded><![CDATA[<p>Wow. Didn&#8217;t see that one coming.</p>
<p>Today Sun <a href="http://blogs.mysql.com/kaj/sun-acquires-mysql.html/">announced they are acquiring MySQL</a>!  Not many details yet but&#8230; wow.</p>
]]></content:encoded>
			<wfw:commentRss>http://thecrumb.com/2008/01/16/sun-buys-mysql/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

