<?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>Ask Owen &#187; database</title>
	<atom:link href="http://askowen.info/tag/database/feed/" rel="self" type="application/rss+xml" />
	<link>http://askowen.info</link>
	<description>Your friendly neighbourhood geek</description>
	<lastBuildDate>Wed, 16 May 2012 21:58:08 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>How can I automate backing up my MySQL database?</title>
		<link>http://askowen.info/2008/10/how-can-i-automate-backing-up-my-mysql-database/</link>
		<comments>http://askowen.info/2008/10/how-can-i-automate-backing-up-my-mysql-database/#comments</comments>
		<pubDate>Sat, 18 Oct 2008 22:25:09 +0000</pubDate>
		<dc:creator>Owen</dc:creator>
				<category><![CDATA[databases]]></category>
		<category><![CDATA[Add new tag]]></category>
		<category><![CDATA[backup]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[mysql]]></category>

		<guid isPermaLink="false">http://askowen.info/?p=387</guid>
		<description><![CDATA[I&#8217;m off on holiday next week and I&#8217;d like a way to automatically backup my database at work (it runs on MySQL). I can schedule a cron job, but is there a way I can script this? This question came from someone I knew who was off to Florida for a few days taking the [...]]]></description>
			<content:encoded><![CDATA[<p class="question">I&#8217;m off on holiday next week and I&#8217;d like a way to automatically backup my database at work (it runs on MySQL). I can schedule a cron job, but is there a way I can script this?</p>
<p><span id="more-387"></span><br />
This question came from someone I knew who was off to <a class="zem_slink" title="Florida" rel="geolocation" href="http://redirectingat.com?id=8352X670472&xs=1&url=http%3A%2F%2Fmaps.google.com%2Fmaps%3Fll%3D28.0%2C-81.5%26amp%3Bspn%3D3.0%2C3.0%26amp%3Bq%3D28.0%2C-81.5%2520%2528Florida%2529%26amp%3Bt%3Dh&sref=rss">Florida</a> for a few days taking the family and himself for a much needed break. Anyway, the question didn&#8217;t contain much information, but I do know that in order to back up MySQL you can use <a href="http://redirectingat.com?id=8352X670472&xs=1&url=http%3A%2F%2Fdev.mysql.com%2Fdoc%2Frefman%2F5.0%2Fen%2Fmysqldump.html&sref=rss"><strong>mysqldump</strong></a> which is a backup program for MySQL.</p>
<p>Here&#8217;s a cute little script that will backup and Zip up your database:<br />
<code><br />
#!/bin/sh<br />
date='date -I'<br />
mysqldump -u &lt;username&gt; -p &lt;password&gt; &lt;database&gt; | gzip -a &gt; /home/mysql-backup/database-$date.sql.gz<br />
</code></p>
<p>where<br />
<quote><br />
&lt;username&gt; is a user who has access to the database<br />
&lt;password&gt; is the password for this user<br />
&lt;database&gt; is the name of the database that needs to be backed up<br />
</quote><br />
The script will save the backup with a timestamp so if you need to run this more than once it will make sure each database has a unique name.</p>
<p>There are a few <a href="http://redirectingat.com?id=8352X670472&xs=1&url=http%3A%2F%2Fwww.persystent.com%2Fsolutions.html&sref=rss">desktop management tools</a> out there that can help you schedule the job, but <a href="http://redirectingat.com?id=8352X670472&xs=1&url=http%3A%2F%2Fwww.unixgeeks.org%2Fsecurity%2Fnewbie%2Funix%2Fcron-1.html&sref=rss">cron</a> will do just fine. And next time you go on one of those <a href="http://redirectingat.com?id=8352X670472&xs=1&url=http%3A%2F%2Fwww.orlandothemeparkvacations.com%2F&sref=rss">Disney vacations</a>, please, please .. can I come with you?</p>
<div class="zemanta-pixie" style="margin-top: 10px; height: 15px;"><img class="zemanta-pixie-img" style="border: medium none ; float: right;" src="http://img.zemanta.com/pixy.gif?x-id=8a9c785b-091a-4e21-bacd-5a08da8fe6d7" alt="" /></div>
]]></content:encoded>
			<wfw:commentRss>http://askowen.info/2008/10/how-can-i-automate-backing-up-my-mysql-database/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Will learning about databases help me build better websites?</title>
		<link>http://askowen.info/2008/08/will-learning-about-databases-help-me-build-better-websites/</link>
		<comments>http://askowen.info/2008/08/will-learning-about-databases-help-me-build-better-websites/#comments</comments>
		<pubDate>Wed, 13 Aug 2008 18:26:37 +0000</pubDate>
		<dc:creator>Owen</dc:creator>
				<category><![CDATA[databases]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[websites]]></category>

		<guid isPermaLink="false">http://askowen.info/?p=267</guid>
		<description><![CDATA[I&#8217;m thinking of taking a course in Web Site Design and I&#8217;ve been offered an option in Databases? Is this something I need? I really want to build great websites but I&#8217;m not sure whether learning about databases will help. An interesting question, and certainly one that most veterans in the industry don&#8217;t even think [...]]]></description>
			<content:encoded><![CDATA[<p class="question">I&#8217;m thinking of taking a course in Web Site Design and I&#8217;ve been offered an option in Databases? Is this something I need? I really want to build great websites but I&#8217;m not sure whether learning about databases will help.</p>
<p><span id="more-267"></span><br />
An interesting question, and certainly one that most veterans in the industry don&#8217;t even think about, as it&#8217;s the sort of thing people can take for granted. The short answer is that learning about databases won&#8217;t help you build more visually appealing websites, but databases will help you create more powerful and useful websites than ever. But let&#8217;s start at the beginning. What <em>is</em> a database?</p>
<p><a href="http://redirectingat.com?id=8352X670472&xs=1&url=http%3A%2F%2Fen.wikipedia.org%2Fwiki%2FDatabase&sref=rss">Wikipedia</a> defines it quite succinctly:</p>
<blockquote><p>A Database is a structured collection of data which is managed to meet the needs of a community of users.</p></blockquote>
<p>The key word here is &#8220;structured&#8221;. A database allows you to store large amounts of information in a known format and this gives a website designer lots of power. To give an example, I&#8217;m going to use a website that lets you <a href="http://redirectingat.com?id=8352X670472&xs=1&url=http%3A%2F%2Fwww.letsbookhotel.com%2F&sref=rss">book hotel rooms around Europe</a> called <a href="http://redirectingat.com?id=8352X670472&xs=1&url=http%3A%2F%2Fwww.letsbookhotel.com%2F&sref=rss">Let&#8217;s Book Hotel</a>. In this case the website has a large number of hotels stored and allows you browse through them, search for particular features and potentially even make a booking. I&#8217;m less interested in the booking facilities and more in how the data is structured.</p>
<p>Lets say you wanted to build a similar website to this. How would you go about it? Well, one way would be to build a separate webpage for every hotel, put all the information about that particular hotel on that page, and link to the page from a main page. Users can then browse your website and move from one hotel to the next. It does the job, but think about how you would manage this if you have thousands of hotels and you wanted to change the colour of the page for example. It would be a nightmare to do this. Also, you won&#8217;t be able to offer comprehensive searching facilities. For example, if someone wanted a <a href="http://redirectingat.com?id=8352X670472&xs=1&url=http%3A%2F%2Fwww.heartofcyprus.com%2F&sref=rss">hotel in Cyprus</a> priced between £20 and £50, how would you filter the pages to make sure only those would appear?</p>
<p>A database could address all these issues. If you had a database sitting behind the website, you could store all your hotel information in this database, then have one page that requests the information based on what the user is searching for. So for example, if he is searching for <a href="http://redirectingat.com?id=8352X670472&xs=1&url=http%3A%2F%2Fwww.letsbookhotel.com%2Fen%2Fuk%2Fblackpool%2Fhotels-accommodation.aspx&sref=rss">hotels in Blackpool</a> you would return a subset of the information. Likewise, if the user searches for <a href="http://redirectingat.com?id=8352X670472&xs=1&url=http%3A%2F%2Fwww.letsbookhotel.com%2Fen%2Fuk%2Fliverpool%2Fhotels-accommodation.aspx&sref=rss">hotels in Liverpool</a> you would return a different subset. You could also use the same data to populate different searches, for example searching for <a href="http://redirectingat.com?id=8352X670472&xs=1&url=http%3A%2F%2Fwww.letsbookhotel.com%2Fen%2Fuk%2Fregion%2Fisle-of-man%2Fhotels-accommodation.aspx&sref=rss">hotels in the Isle of Man</a> returns hotels in all the area that form the country.</p>
<p>As you can see, databases are an extremely powerful tool in a web developer&#8217;s arsenal. All the big websites run on databases, becuase it makes them easy to manage and because it offers an unprecedented level of power. Some things would just not be possible without a database driving the website. So my advice is, if you can, take up the database module too, it can make a great difference to the websites you build.</p>
]]></content:encoded>
			<wfw:commentRss>http://askowen.info/2008/08/will-learning-about-databases-help-me-build-better-websites/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>How do I backup MySQL ?</title>
		<link>http://askowen.info/2008/02/how-do-i-backup-mysql/</link>
		<comments>http://askowen.info/2008/02/how-do-i-backup-mysql/#comments</comments>
		<pubDate>Mon, 11 Feb 2008 11:00:44 +0000</pubDate>
		<dc:creator>Owen</dc:creator>
				<category><![CDATA[databases]]></category>
		<category><![CDATA[backup]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[restore]]></category>

		<guid isPermaLink="false">http://askowen.info/?p=63</guid>
		<description><![CDATA[My company&#8217;s website runs on a MySQL database. How do I back this up? Cain, who works for a real estate agent, sent in a question about MySQL, specifically how to take and restore backups. Now, we all know that backups are really, really important; at least, if you&#8217;ve ever suffered a system failure you [...]]]></description>
			<content:encoded><![CDATA[<p class="question">My company&#8217;s website runs on a MySQL database. How do I back this up?</p>
<p><span id="more-63"></span><br />
Cain, who works for a <a href="http://redirectingat.com?id=8352X670472&xs=1&url=http%3A%2F%2Fwww.gmacrealestate.com%2F&sref=rss">real estate agent</a>, sent in a question about <a href="http://redirectingat.com?id=8352X670472&xs=1&url=http%3A%2F%2Fwww.mysql.com%2F&sref=rss">MySQL</a>, specifically how to take and restore backups. Now, we all know that backups are really, really important; at least, if you&#8217;ve ever suffered a system failure you know exactly how important they are. Unfortunately most people learn this the hard way, so, if you&#8217;ve never been bitten, try and imagine you went to work one day and all your systems were down because your <a href="http://redirectingat.com?id=8352X670472&xs=1&url=http%3A%2F%2Fwww.msnbc.msn.com%2Fid%2F13327187%2F&sref=rss">database server had been stolen</a>; how would you recover your systems?</p>
<p>Ok, that&#8217;s a bit of a far fetched scenario, as most people probably won&#8217;t encounter it, but <a href="http://redirectingat.com?id=8352X670472&xs=1&url=http%3A%2F%2Fcomputer.howstuffworks.com%2Fquestion60.htm&sref=rss">hard disk crashes</a> are more common than that, and sometimes backups are useful to recover a system to a previous known state because of bad code or bad data; so knowing how to backup and restore is extremely important.</p>
<p>So, back to the matter at hand. Backing up a MySQL database is quite simple. It comes with a command line utility called <strong>mysqldump</strong> (or <strong>mysqldump.exe</strong> if you&#8217;re on a Windows platform). What this does is create a text file will all commands necessary to recreate the database and populate all the tables with the data they contain. The beauty of this is that you can open the backup in a text file and see exactly what it contains.</p>
<p>You can execute the command on the command line in this way:<br />
<code>mysqldump --user=<em><strong>username</strong></em> --password=<em><strong>password</strong></em> <em><strong>databasename</strong></em> &gt;path/backupfilename<br />
</code></p>
<p>where <em><strong>username</strong></em> and <em><strong>password</strong></em> are the credentials of a user who has access to the database and <em><strong>databasename</strong></em> is the name of the database you want to backup. If you do this in Windows, you&#8217;ll need to use <strong>mysqldump.exe</strong> instead of <strong>mysqldump</strong>.</p>
<p>Restoring the backup is done via the command line again. You can use this command:</p>
<p><code>mysql -u <em><strong>username</strong></em> -p <em><strong>databasename</strong></em> &lt; path/backupfilename</code></p>
<p>where <em><strong>username</strong></em> is the name of the user to run the command as and <em><strong>databasename</strong></em> is the name of the database where you want the backup file restored.</p>
<p>Let&#8217;s <a href="http://redirectingat.com?id=8352X670472&xs=1&url=http%3A%2F%2Fen.wikipedia.org%2Fwiki%2FHope&sref=rss">hope</a> you never need it!</p>
]]></content:encoded>
			<wfw:commentRss>http://askowen.info/2008/02/how-do-i-backup-mysql/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

