<?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>David Nash &#187; mysql</title>
	<atom:link href="http://davidnash.com.au/tag/mysql/feed/" rel="self" type="application/rss+xml" />
	<link>http://davidnash.com.au</link>
	<description>Freelance PHP developer - builder of high-quality dynamic websites</description>
	<lastBuildDate>Sun, 25 Jul 2010 23:56:32 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Unix Time in MySQL and bash</title>
		<link>http://davidnash.com.au/2009/02/unix-time-mysql-bash/</link>
		<comments>http://davidnash.com.au/2009/02/unix-time-mysql-bash/#comments</comments>
		<pubDate>Wed, 04 Feb 2009 08:27:58 +0000</pubDate>
		<dc:creator>David</dc:creator>
				<category><![CDATA[bash]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://davidnash.com.au/?p=115</guid>
		<description><![CDATA[A quick one today. I was working on a mysql database that used unix timestamp produced by PHP&#8217;s time() function.
I needed to be able to quickly convert this time to a human-readable format. In bash, 
date -d @timestamp
is a quick way to convert.
In a terminal shell eg:
# date -d @1224992980
Sun Oct 26 14:49:40 EST 2008
In [...]]]></description>
			<content:encoded><![CDATA[<p>A quick one today. I was working on a mysql database that used unix timestamp produced by <a href="http://au2.php.net/time">PHP&#8217;s time() function</a>.</p>
<p>I needed to be able to quickly convert this time to a human-readable format. In bash, <strong></strong></p>
<blockquote><p>date -d<strong> @</strong>timestamp</p></blockquote>
<p>is a quick way to convert.</p>
<p>In a terminal shell eg:</p>
<blockquote><p># date -d @1224992980<br />
Sun Oct 26 14:49:40 EST 2008</p></blockquote>
<p>In a MySQL client, you could also use</p>
<blockquote><p>select date(from_unixtime(column_name)) from table_name;</p></blockquote>
<p>Or if you want a little more flexibility in the output, for example outputting 27/02/09, you could do:</p>
<blockquote><p>select date_format(from_unixtime(column_name), &#8216;%d/%m/%y&#8217;) from table_name;</p></blockquote>
<p><em>This post is one of my most popular posts. <strong>Did you find the information you were after? Please tell me in the comments!</strong></em></p>



Share:


	<a rel="nofollow" target="_blank" href="http://del.icio.us/post?url=http%3A%2F%2Fdavidnash.com.au%2F2009%2F02%2Funix-time-mysql-bash%2F&amp;title=Unix%20Time%20in%20MySQL%20and%20bash" title="del.icio.us"><img src="http://davidnash.com.au/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a>
	<a rel="nofollow" target="_blank" href="http://www.facebook.com/share.php?u=http%3A%2F%2Fdavidnash.com.au%2F2009%2F02%2Funix-time-mysql-bash%2F&amp;t=Unix%20Time%20in%20MySQL%20and%20bash" title="Facebook"><img src="http://davidnash.com.au/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a>
	<a rel="nofollow" target="_blank" href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fdavidnash.com.au%2F2009%2F02%2Funix-time-mysql-bash%2F&amp;title=Unix%20Time%20in%20MySQL%20and%20bash" title="Google"><img src="http://davidnash.com.au/wp-content/plugins/sociable/images/googlebookmark.png" title="Google" alt="Google" class="sociable-hovers" /></a>
	<a rel="nofollow" target="_blank" href="mailto:?subject=Unix%20Time%20in%20MySQL%20and%20bash&amp;body=http%3A%2F%2Fdavidnash.com.au%2F2009%2F02%2Funix-time-mysql-bash%2F" title="E-mail this story to a friend!"><img src="http://davidnash.com.au/wp-content/plugins/sociable/images/email_link.png" title="E-mail this story to a friend!" alt="E-mail this story to a friend!" class="sociable-hovers" /></a>
	<a rel="nofollow" target="_blank" href="http://technorati.com/faves?add=http%3A%2F%2Fdavidnash.com.au%2F2009%2F02%2Funix-time-mysql-bash%2F" title="Technorati"><img src="http://davidnash.com.au/wp-content/plugins/sociable/images/technorati.png" title="Technorati" alt="Technorati" class="sociable-hovers" /></a>
	<a rel="nofollow" target="_blank" href="http://twitter.com/home?status=http%3A%2F%2Fdavidnash.com.au%2F2009%2F02%2Funix-time-mysql-bash%2F" title="TwitThis"><img src="http://davidnash.com.au/wp-content/plugins/sociable/images/twitter.gif" title="TwitThis" alt="TwitThis" class="sociable-hovers" /></a>


<br/><br/>]]></content:encoded>
			<wfw:commentRss>http://davidnash.com.au/2009/02/unix-time-mysql-bash/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Create a MySQL database</title>
		<link>http://davidnash.com.au/2009/01/create-a-mysql-database/</link>
		<comments>http://davidnash.com.au/2009/01/create-a-mysql-database/#comments</comments>
		<pubDate>Wed, 21 Jan 2009 01:24:08 +0000</pubDate>
		<dc:creator>David</dc:creator>
				<category><![CDATA[mysql]]></category>

		<guid isPermaLink="false">http://davidnash.com.au/?p=64</guid>
		<description><![CDATA[I generally only need to do this once for each project, which means I don&#8217;t do it often enough to remember. Log in to the MySQL server as root, then:

create database newdb;
grant all on newdb.* to 'newuser'@'localhost' identified by 'newuser';
set password for 'newuser'@'localhost' = password('newpass');

And you&#8217;re ready to go!
Replace newdb, newuser and newpass with whatever [...]]]></description>
			<content:encoded><![CDATA[<p>I generally only need to do this once for each project, which means I don&#8217;t do it often enough to remember. Log in to the MySQL server as root, then:<br />
<code><br />
create database newdb;<br />
grant all on newdb.* to 'newuser'@'localhost' identified by 'newuser';<br />
set password for 'newuser'@'localhost' = password('newpass');<br />
</code><br />
And you&#8217;re ready to go!<br />
Replace newdb, newuser and newpass with whatever you like.</p>



Share:


	<a rel="nofollow" target="_blank" href="http://del.icio.us/post?url=http%3A%2F%2Fdavidnash.com.au%2F2009%2F01%2Fcreate-a-mysql-database%2F&amp;title=Create%20a%20MySQL%20database" title="del.icio.us"><img src="http://davidnash.com.au/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a>
	<a rel="nofollow" target="_blank" href="http://www.facebook.com/share.php?u=http%3A%2F%2Fdavidnash.com.au%2F2009%2F01%2Fcreate-a-mysql-database%2F&amp;t=Create%20a%20MySQL%20database" title="Facebook"><img src="http://davidnash.com.au/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a>
	<a rel="nofollow" target="_blank" href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fdavidnash.com.au%2F2009%2F01%2Fcreate-a-mysql-database%2F&amp;title=Create%20a%20MySQL%20database" title="Google"><img src="http://davidnash.com.au/wp-content/plugins/sociable/images/googlebookmark.png" title="Google" alt="Google" class="sociable-hovers" /></a>
	<a rel="nofollow" target="_blank" href="mailto:?subject=Create%20a%20MySQL%20database&amp;body=http%3A%2F%2Fdavidnash.com.au%2F2009%2F01%2Fcreate-a-mysql-database%2F" title="E-mail this story to a friend!"><img src="http://davidnash.com.au/wp-content/plugins/sociable/images/email_link.png" title="E-mail this story to a friend!" alt="E-mail this story to a friend!" class="sociable-hovers" /></a>
	<a rel="nofollow" target="_blank" href="http://technorati.com/faves?add=http%3A%2F%2Fdavidnash.com.au%2F2009%2F01%2Fcreate-a-mysql-database%2F" title="Technorati"><img src="http://davidnash.com.au/wp-content/plugins/sociable/images/technorati.png" title="Technorati" alt="Technorati" class="sociable-hovers" /></a>
	<a rel="nofollow" target="_blank" href="http://twitter.com/home?status=http%3A%2F%2Fdavidnash.com.au%2F2009%2F01%2Fcreate-a-mysql-database%2F" title="TwitThis"><img src="http://davidnash.com.au/wp-content/plugins/sociable/images/twitter.gif" title="TwitThis" alt="TwitThis" class="sociable-hovers" /></a>


<br/><br/>]]></content:encoded>
			<wfw:commentRss>http://davidnash.com.au/2009/01/create-a-mysql-database/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
