<?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>Sean&#039;s Blog &#187; MySQL</title>
	<atom:link href="http://seanbehan.com/tag/mysql/feed/" rel="self" type="application/rss+xml" />
	<link>http://seanbehan.com</link>
	<description>Web Programming, Ruby on Rails, Wordpress, PHP from Burlington, Vermont</description>
	<lastBuildDate>Wed, 18 Jan 2012 21:44:54 +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>Backup and Rotate MySQL Databases Simple Bash Script</title>
		<link>http://seanbehan.com/databases/backup-and-rotate-mysql-databases-simple-bash-script/</link>
		<comments>http://seanbehan.com/databases/backup-and-rotate-mysql-databases-simple-bash-script/#comments</comments>
		<pubDate>Sat, 04 Jun 2011 16:29:48 +0000</pubDate>
		<dc:creator>bseanvt</dc:creator>
				<category><![CDATA[Databases]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[backups]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[cron]]></category>
		<category><![CDATA[data]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[mysqldump]]></category>
		<category><![CDATA[scripting]]></category>
		<category><![CDATA[shell]]></category>

		<guid isPermaLink="false">http://seanbehan.com/?p=1343</guid>
		<description><![CDATA[Make a directory ( it can anywhere ) called baks/mysql mkdir -p /baks/mysql Create a file (it can be anywhere) called /root/mysql_backups.sh and put this script in it #!/bin/bash # modify the following to suit your environment export DB_BACKUP=&#34;/baks/mysql&#34; export DB_USER=&#34;root&#34; export DB_PASSWD=&#34;your-mysql-password-goes-here&#34; # title and version echo &#34;&#34; echo &#34;Backup and rotate all mysql [...]]]></description>
			<content:encoded><![CDATA[<div style="height:33px;" class="really_simple_share robots-nocontent snap_nopreview"><div class="really_simple_share_facebook_like" style="width:px;">
				<iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fseanbehan.com%2Fdatabases%2Fbackup-and-rotate-mysql-databases-simple-bash-script%2F&amp;layout=button_count&amp;show_faces=false&amp;width=&amp;action=like&amp;colorscheme=light&amp;send=false&amp;height=27" 
						scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:px; height:27px;" allowTransparency="true"></iframe>
				</div><div class="really_simple_share_twitter" style="width:px;">
					<a href="http://twitter.com/share" class="twitter-share-button" data-count="horizontal" 
						data-text="Backup and Rotate MySQL Databases Simple Bash Script" data-url="http://seanbehan.com/databases/backup-and-rotate-mysql-databases-simple-bash-script/" 
						data-via="" ></a> 
				</div></div>
		<div style="clear:both;"></div><p>Make a directory ( it can anywhere ) called baks/mysql</p>
<pre class="wp-code-highlight prettyprint">
mkdir -p /baks/mysql
</pre>
<p>Create a file (it can be anywhere) called /root/mysql_backups.sh and put this script in it</p>
<pre class="wp-code-highlight prettyprint">
#!/bin/bash

# modify the following to suit your environment
export DB_BACKUP=&quot;/baks/mysql&quot;
export DB_USER=&quot;root&quot;
export DB_PASSWD=&quot;your-mysql-password-goes-here&quot;

# title and version
echo &quot;&quot;
echo &quot;Backup and rotate all mysql databases&quot;
echo &quot;--------------------------&quot;

rm -rf $DB_BACKUP/04
mv $DB_BACKUP/03 $DB_BACKUP/04
mv $DB_BACKUP/02 $DB_BACKUP/03
mv $DB_BACKUP/01 $DB_BACKUP/02
mkdir $DB_BACKUP/01

echo &quot;* Creating backup...&quot;
mysqldump --user=$DB_USER --password=$DB_PASSWD --all-databases | bzip2 &gt; $DB_BACKUP/01/mysql-`date +%Y-%m-%d`.bz2
echo &quot;----------------------&quot;
echo &quot;Done&quot;
exit 0
</pre>
<p>Install it via cron and have it run at 3:10 am every morning.</p>
<pre class="wp-code-highlight prettyprint">
crontab -e

10 3 * * * /root/mysql_backups.sh  &gt; /baks/status.log
</pre>
<p>This script will save the last 4 days of data.</p>
]]></content:encoded>
			<wfw:commentRss>http://seanbehan.com/databases/backup-and-rotate-mysql-databases-simple-bash-script/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Installing Ruby on Rails 3, MySQL, Git, Ruby Enterprise Edition, Passenger (Mod_Rails) on Ubuntu with Rackspace Cloud.</title>
		<link>http://seanbehan.com/ruby-on-rails/installing-ruby-on-rails-3-mysql-git-ruby-enterprise-edition-passenger-mod_rails-on-ubuntu-with-rackspace-cloud/</link>
		<comments>http://seanbehan.com/ruby-on-rails/installing-ruby-on-rails-3-mysql-git-ruby-enterprise-edition-passenger-mod_rails-on-ubuntu-with-rackspace-cloud/#comments</comments>
		<pubDate>Wed, 23 Mar 2011 19:12:46 +0000</pubDate>
		<dc:creator>bseanvt</dc:creator>
				<category><![CDATA[Ruby on Rails]]></category>
		<category><![CDATA[deployment]]></category>
		<category><![CDATA[Git]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[rackspace]]></category>
		<category><![CDATA[Rails]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[ruby enterprise edition]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://seanbehan.com/?p=1269</guid>
		<description><![CDATA[Short and sweet. Here all the commands I run in this order to set up a brand new box. It usually takes about 10 &#8211; 15 minutes on a 256 MB RAM instance. Compiling Ruby Enterprise Edition, which is super easy, will take the most amount of time. It will seem to have gotten stuck. [...]]]></description>
			<content:encoded><![CDATA[<div style="height:33px;" class="really_simple_share robots-nocontent snap_nopreview"><div class="really_simple_share_facebook_like" style="width:px;">
				<iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fseanbehan.com%2Fruby-on-rails%2Finstalling-ruby-on-rails-3-mysql-git-ruby-enterprise-edition-passenger-mod_rails-on-ubuntu-with-rackspace-cloud%2F&amp;layout=button_count&amp;show_faces=false&amp;width=&amp;action=like&amp;colorscheme=light&amp;send=false&amp;height=27" 
						scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:px; height:27px;" allowTransparency="true"></iframe>
				</div><div class="really_simple_share_twitter" style="width:px;">
					<a href="http://twitter.com/share" class="twitter-share-button" data-count="horizontal" 
						data-text="Installing Ruby on Rails 3, MySQL, Git, Ruby Enterprise Edition, Passenger (Mod_Rails) on Ubuntu with Rackspace Cloud." data-url="http://seanbehan.com/ruby-on-rails/installing-ruby-on-rails-3-mysql-git-ruby-enterprise-edition-passenger-mod_rails-on-ubuntu-with-rackspace-cloud/" 
						data-via="" ></a> 
				</div></div>
		<div style="clear:both;"></div><p>Short and sweet. Here all the commands I run in this order to set up a brand new box. It usually takes about 10 &#8211; 15 minutes on a 256 MB RAM instance. Compiling Ruby Enterprise Edition, which is super easy, will take the most amount of time. It will seem to have gotten stuck. It hasn&#8217;t. It just takes a little while. </p>
<pre class="wp-code-highlight prettyprint">
# Update, upgrade and install all necessary packages for Ruby on Rails server if you've got a fresh Ubuntu slice
apt-get update
apt-get upgrade

apt-get install build-essential patch libssl-dev libreadline5-dev

apt-get install ruby1.8-dev ruby1.8 ri1.8 rdoc1.8 irb1.8 libreadline-ruby1.8 libruby1.8 libopenssl-ruby imagemagick librmagick-ruby1.8 librmagick-ruby-doc libfreetype6-dev xml-core postfix
# postfix will prompt you for details
# use Internet Site and enter in the domain name you are planning on sending email from 

apt-get install apache2 apache2-prefork-dev libapr1-dev libaprutil1-dev libcurl4-openssl-dev git-core mysql-server mysql-client libmysqlclient15-dev libmysql-ruby
# mysql will also prompt you to set up a root user account. set the password to be anything you like

# next, download the latest release of ruby enterprise edition but when you're installing it on your own machine version numbers and release dates may have changed.
# pay attention to the version and release date before the file extension. it will be something like
# ... 1.8.7-2010.02
# this will change to something like 2011.03, 2011.04... etc in the future.
# just double check the paths on when you are installing and make the necessary substitutions

# ruby enterprise edition is available at http://www.rubyenterpriseedition.com/download.html
wget http://rubyforge.org/frs/download.php/71096/ruby-enterprise-1.8.7-2010.02.tar.gz
tar xzvf ruby-enterprise-1.8.7-2010.02.tar.gz 

./ruby-enterprise-1.8.7-2010.02/installer
# this may take a little while (just follow the instructions)
# and hit enter to install in default location (recommended) when prompted 

# and to install passenger (which is mod_rails for apache)
/opt/ruby-enterprise-1.8.7-2010.02/bin/passenger-install-apache2-module 

# i take the output from the above script and add it to my available modules directory
vim /etc/apache2/mods-available/passenger.conf

# and enter something like this in the newly created file (your version numbers will prob. be different)
LoadModule passenger_module /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/passenger-3.0.2/ext/apache2/mod_passenger.so
PassengerRoot /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/passenger-3.0.2
PassengerRuby /opt/ruby-enterprise-1.8.7-2010.02/bin/ruby

# and then sym link it to the enabled directory so that apache knows about it
ln -s /etc/apache2/mods-available/passenger.conf /etc/apache2/mods-enabled/passenger.conf

# and now i want to include ruby enterprise edition in my path so i add it to my profile (again make sure the path is correct)
vim /etc/profile.d/passenger.sh
export PATH=/opt/ruby-enterprise-1.8.7-2010.02/bin:$PATH

. /etc/profile.d/passenger.sh
# the &quot;.&quot; file will make the setting available for the current terminal session
rails -v
ruby -v
rake -v
# should all be working now
# and
which ruby
# should point to the ruby enterprise edition under /opt

# next i
# set up public/private keys
# so i can do
# ssh localhost without using a password
cd
test -e ~/.ssh/id_dsa.pub || ssh-keygen -t dsa
cat ~/.ssh/id_dsa.pub &gt;&gt; ~/.ssh/authorized_keys2

# and finally install git
apt-get install git-core
</pre>
<p>You should now have a server ready to server ruby on rails applications!</p>
]]></content:encoded>
			<wfw:commentRss>http://seanbehan.com/ruby-on-rails/installing-ruby-on-rails-3-mysql-git-ruby-enterprise-edition-passenger-mod_rails-on-ubuntu-with-rackspace-cloud/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Deploying to Dreamhost</title>
		<link>http://seanbehan.com/posts/deploying-to-dreamhost/</link>
		<comments>http://seanbehan.com/posts/deploying-to-dreamhost/#comments</comments>
		<pubDate>Mon, 09 Aug 2010 15:43:24 +0000</pubDate>
		<dc:creator>bseanvt</dc:creator>
				<category><![CDATA[Posts]]></category>
		<category><![CDATA[configuration]]></category>
		<category><![CDATA[dreamhost]]></category>
		<category><![CDATA[freeze]]></category>
		<category><![CDATA[gems]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[port]]></category>
		<category><![CDATA[Rails]]></category>
		<category><![CDATA[unpack]]></category>

		<guid isPermaLink="false">http://seanbehan.com/?p=1115</guid>
		<description><![CDATA[Remember to include the host declaration in the database.yml file when you deploy to Dreamhost. Dreamhost does not use &#8220;localhost&#8221; which is typically the default setting when using the mysql adapter and developing locally or even on a small site. At least for me, when I ported a Rails app to Dreamhost, this was the [...]]]></description>
			<content:encoded><![CDATA[<div style="height:33px;" class="really_simple_share robots-nocontent snap_nopreview"><div class="really_simple_share_facebook_like" style="width:px;">
				<iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fseanbehan.com%2Fposts%2Fdeploying-to-dreamhost%2F&amp;layout=button_count&amp;show_faces=false&amp;width=&amp;action=like&amp;colorscheme=light&amp;send=false&amp;height=27" 
						scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:px; height:27px;" allowTransparency="true"></iframe>
				</div><div class="really_simple_share_twitter" style="width:px;">
					<a href="http://twitter.com/share" class="twitter-share-button" data-count="horizontal" 
						data-text="Deploying to Dreamhost" data-url="http://seanbehan.com/posts/deploying-to-dreamhost/" 
						data-via="" ></a> 
				</div></div>
		<div style="clear:both;"></div><p>Remember to include the host declaration in the database.yml file when you deploy to Dreamhost. Dreamhost does not use &#8220;localhost&#8221; which is typically the default setting when using the mysql adapter and developing locally or even on a small site. </p>
<p>At least for me, when I ported a Rails app to Dreamhost, this was the only &#8220;Gotcha&#8221;, because my log files were not reporting any errors and were instead serving the 500 something went wrong file.<br />
A sample config/database.yml file</p>
<pre class="wp-code-highlight prettyprint">
production:
  adapter: mysql
  username: youruser
  password: yourpasswd
  database: ror_production_db
  host: mysql.yourdomain.com
</pre>
<p>To port, I unpack my gems, if I haven&#8217;t already</p>
<pre class="wp-code-highlight prettyprint">
rake gems:unpack
</pre>
<p>Then I freeze and package rails w/ my app just in case versions aren&#8217;t exact</p>
<pre class="wp-code-highlight prettyprint">
rake rails:freeze:gems
</pre>
<p>Then I upload to Dreamhost!</p>
]]></content:encoded>
			<wfw:commentRss>http://seanbehan.com/posts/deploying-to-dreamhost/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>My Review of Moodle 1.9 Extension Development</title>
		<link>http://seanbehan.com/programming/review-of-moodle-1-9-extension-development/</link>
		<comments>http://seanbehan.com/programming/review-of-moodle-1-9-extension-development/#comments</comments>
		<pubDate>Fri, 04 Jun 2010 19:59:52 +0000</pubDate>
		<dc:creator>bseanvt</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[api]]></category>
		<category><![CDATA[book review]]></category>
		<category><![CDATA[moodle]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[software development]]></category>

		<guid isPermaLink="false">http://seanbehan.com/?p=1040</guid>
		<description><![CDATA[I wrote a review for Joseph Thibault&#8217;s Moodle News on extension development for Moodle. The book is quite good and I think an essential resource for anyone wanting to develop in Moodle. The book focuses on plugin development, but it will also give you an overview of the architecture, api and best practices. I wish [...]]]></description>
			<content:encoded><![CDATA[<div style="height:33px;" class="really_simple_share robots-nocontent snap_nopreview"><div class="really_simple_share_facebook_like" style="width:px;">
				<iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fseanbehan.com%2Fprogramming%2Freview-of-moodle-1-9-extension-development%2F&amp;layout=button_count&amp;show_faces=false&amp;width=&amp;action=like&amp;colorscheme=light&amp;send=false&amp;height=27" 
						scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:px; height:27px;" allowTransparency="true"></iframe>
				</div><div class="really_simple_share_twitter" style="width:px;">
					<a href="http://twitter.com/share" class="twitter-share-button" data-count="horizontal" 
						data-text="My Review of Moodle 1.9 Extension Development" data-url="http://seanbehan.com/programming/review-of-moodle-1-9-extension-development/" 
						data-via="" ></a> 
				</div></div>
		<div style="clear:both;"></div><p>I wrote a review for <a href="http://moodlenews.com">Joseph Thibault&#8217;s Moodle News</a> on extension development for Moodle. The book is quite good and I think an essential resource for anyone wanting to develop in Moodle. The book focuses on plugin development, but it will also give you an overview of the architecture, api and best practices.</p>
<p>I wish I had this book about 3 years ago when I first started fooling around in the code base! At any rate, you can read the review on <a href="http://moodlenews.com">Moodle News</a> at <a href="http://www.moodlenews.com/2010/moodle-1-9-extension-development-review-by-bseanvt/">http://www.moodlenews.com/2010/moodle-1-9-extension-development-review-by-bseanvt/</a></p>
<p>There is also an interesting discussion underway about the &#8216;bloat&#8217; in the Moodle code at <a href="http://www.moodlenews.com/2010/opinion-1000000-lines-of-code/">http://www.moodlenews.com/2010/opinion-1000000-lines-of-code/</a></p>
]]></content:encoded>
			<wfw:commentRss>http://seanbehan.com/programming/review-of-moodle-1-9-extension-development/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Workshop Dog</title>
		<link>http://seanbehan.com/projects/workshop-dog/</link>
		<comments>http://seanbehan.com/projects/workshop-dog/#comments</comments>
		<pubDate>Thu, 20 May 2010 14:31:26 +0000</pubDate>
		<dc:creator>bseanvt</dc:creator>
				<category><![CDATA[Projects]]></category>
		<category><![CDATA[dog training]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[Rails]]></category>
		<category><![CDATA[workshop dog]]></category>

		<guid isPermaLink="false">http://seanbehan.com/?p=996</guid>
		<description><![CDATA[Workshop Dog is a free events calendar for dog training workshops and group lessons. Users can list their training workshops as well as create a business profile. Jobs may be posted to the site for a small fee. Events that are created are distributed to Facebook fan page and twitter account @workshopdogs. The site is [...]]]></description>
			<content:encoded><![CDATA[<div style="height:33px;" class="really_simple_share robots-nocontent snap_nopreview"><div class="really_simple_share_facebook_like" style="width:px;">
				<iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fseanbehan.com%2Fprojects%2Fworkshop-dog%2F&amp;layout=button_count&amp;show_faces=false&amp;width=&amp;action=like&amp;colorscheme=light&amp;send=false&amp;height=27" 
						scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:px; height:27px;" allowTransparency="true"></iframe>
				</div><div class="really_simple_share_twitter" style="width:px;">
					<a href="http://twitter.com/share" class="twitter-share-button" data-count="horizontal" 
						data-text="Workshop Dog" data-url="http://seanbehan.com/projects/workshop-dog/" 
						data-via="" ></a> 
				</div></div>
		<div style="clear:both;"></div><p><a href="http://workshopdog.com" target="_self">Workshop Dog</a> is a free events calendar for dog training workshops and group lessons.<br />
<span id="more-996"></span></p>
<p>Users can list their training workshops as well as create a business profile. Jobs may be posted to the site for a small fee. Events that are created are distributed to Facebook <a href="http://facebook.com/workshopdog" target="_self">fan page</a> and twitter account <a href="http://twitter.com/workshopdogs" target="_self">@workshopdogs</a>.</p>
<p>The site is built using Ruby on Rails and MySQL.</p>
]]></content:encoded>
			<wfw:commentRss>http://seanbehan.com/projects/workshop-dog/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Dump MySQL Database without Drop Table Syntax</title>
		<link>http://seanbehan.com/databases/dump-mysql-database-without-drop-table-syntax/</link>
		<comments>http://seanbehan.com/databases/dump-mysql-database-without-drop-table-syntax/#comments</comments>
		<pubDate>Sat, 06 Feb 2010 00:57:34 +0000</pubDate>
		<dc:creator>bseanvt</dc:creator>
				<category><![CDATA[Databases]]></category>
		<category><![CDATA[flags]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[mysqldump]]></category>
		<category><![CDATA[syntax]]></category>

		<guid isPermaLink="false">http://seanbehan.com/?p=781</guid>
		<description><![CDATA[Output .sql file for MySQL but without the drop table syntax before table name use the &#8211;skip-add-drop-table flag mysqldump -u root -p database_name --skip-add-drop-table --skip-lock-tables &#62; database_name.sql]]></description>
			<content:encoded><![CDATA[<div style="height:33px;" class="really_simple_share robots-nocontent snap_nopreview"><div class="really_simple_share_facebook_like" style="width:px;">
				<iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fseanbehan.com%2Fdatabases%2Fdump-mysql-database-without-drop-table-syntax%2F&amp;layout=button_count&amp;show_faces=false&amp;width=&amp;action=like&amp;colorscheme=light&amp;send=false&amp;height=27" 
						scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:px; height:27px;" allowTransparency="true"></iframe>
				</div><div class="really_simple_share_twitter" style="width:px;">
					<a href="http://twitter.com/share" class="twitter-share-button" data-count="horizontal" 
						data-text="Dump MySQL Database without Drop Table Syntax" data-url="http://seanbehan.com/databases/dump-mysql-database-without-drop-table-syntax/" 
						data-via="" ></a> 
				</div></div>
		<div style="clear:both;"></div><p>Output .sql file for MySQL but without the drop table syntax before table name use the &#8211;skip-add-drop-table flag</p>
<pre class="wp-code-highlight prettyprint">
mysqldump -u root -p database_name --skip-add-drop-table --skip-lock-tables &gt; database_name.sql
</pre>
]]></content:encoded>
			<wfw:commentRss>http://seanbehan.com/databases/dump-mysql-database-without-drop-table-syntax/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Generate MySQL Datetime Type Using PHP Date() Function</title>
		<link>http://seanbehan.com/php/generate-mysql-datetime-type-using-php-date-function/</link>
		<comments>http://seanbehan.com/php/generate-mysql-datetime-type-using-php-date-function/#comments</comments>
		<pubDate>Fri, 05 Feb 2010 18:22:27 +0000</pubDate>
		<dc:creator>bseanvt</dc:creator>
				<category><![CDATA[php]]></category>
		<category><![CDATA[date]]></category>
		<category><![CDATA[datetime]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[strftime]]></category>
		<category><![CDATA[type]]></category>

		<guid isPermaLink="false">http://seanbehan.com/?p=779</guid>
		<description><![CDATA[If you want to insert a datetime that matches the default mysql datetime type format use this date('Y-m-d H:i:s');]]></description>
			<content:encoded><![CDATA[<div style="height:33px;" class="really_simple_share robots-nocontent snap_nopreview"><div class="really_simple_share_facebook_like" style="width:px;">
				<iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fseanbehan.com%2Fphp%2Fgenerate-mysql-datetime-type-using-php-date-function%2F&amp;layout=button_count&amp;show_faces=false&amp;width=&amp;action=like&amp;colorscheme=light&amp;send=false&amp;height=27" 
						scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:px; height:27px;" allowTransparency="true"></iframe>
				</div><div class="really_simple_share_twitter" style="width:px;">
					<a href="http://twitter.com/share" class="twitter-share-button" data-count="horizontal" 
						data-text="Generate MySQL Datetime Type Using PHP Date() Function" data-url="http://seanbehan.com/php/generate-mysql-datetime-type-using-php-date-function/" 
						data-via="" ></a> 
				</div></div>
		<div style="clear:both;"></div><p>If you want to insert a datetime that matches the default mysql datetime type format use this</p>
<pre class="wp-code-highlight prettyprint">
date('Y-m-d H:i:s');
</pre>
]]></content:encoded>
			<wfw:commentRss>http://seanbehan.com/php/generate-mysql-datetime-type-using-php-date-function/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Managing Timestamps in MySQL with a Trigger</title>
		<link>http://seanbehan.com/databases/managing-timestamps-in-mysql-with-a-trigger/</link>
		<comments>http://seanbehan.com/databases/managing-timestamps-in-mysql-with-a-trigger/#comments</comments>
		<pubDate>Thu, 10 Dec 2009 17:13:51 +0000</pubDate>
		<dc:creator>bseanvt</dc:creator>
				<category><![CDATA[Databases]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[sql]]></category>
		<category><![CDATA[timestamping]]></category>
		<category><![CDATA[triggers]]></category>

		<guid isPermaLink="false">http://seanbehan.com/?p=707</guid>
		<description><![CDATA[MySQL doesn&#8217;t support having two columns with time stamping on both initialization and/or on updating at the same time. It would be nice to be able to do *this* where the created_at column gets the current_timestamp on initialization and the updated_at gets changed on updating the row. # like so doesn't work... create table entries( [...]]]></description>
			<content:encoded><![CDATA[<div style="height:33px;" class="really_simple_share robots-nocontent snap_nopreview"><div class="really_simple_share_facebook_like" style="width:px;">
				<iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fseanbehan.com%2Fdatabases%2Fmanaging-timestamps-in-mysql-with-a-trigger%2F&amp;layout=button_count&amp;show_faces=false&amp;width=&amp;action=like&amp;colorscheme=light&amp;send=false&amp;height=27" 
						scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:px; height:27px;" allowTransparency="true"></iframe>
				</div><div class="really_simple_share_twitter" style="width:px;">
					<a href="http://twitter.com/share" class="twitter-share-button" data-count="horizontal" 
						data-text="Managing Timestamps in MySQL with a Trigger" data-url="http://seanbehan.com/databases/managing-timestamps-in-mysql-with-a-trigger/" 
						data-via="" ></a> 
				</div></div>
		<div style="clear:both;"></div><p>MySQL doesn&#8217;t support having two columns with time stamping on both initialization and/or on updating at the same time. It would be nice to be able to do *this* where the created_at column gets the current_timestamp on initialization and the updated_at gets changed on updating the row.</p>
<pre class="wp-code-highlight prettyprint">
# like so doesn't work...
create table entries(
  body blob,
  created_at datetime default current_timestamp,
  updated_at timestamp default current_timestamp on update current_timestamp
);
</pre>
<p>Seems like a feature a lot of folks would like. There are two work-arounds. The first is baking it into your application code with something like</p>
<pre class="wp-code-highlight prettyprint">
create table entries(
  body blob,
  created_at datetime default null,
  updated_at timestamp default current_timestamp on update current_timestamp
);
insert into entries (body, created_at) values ('hello world', now());
</pre>
<p>The second way is to create a trigger and call the trigger on your insert action on a row.</p>
<pre class="wp-code-highlight prettyprint">
create table entries (
  body  blob,
  created_at datetime default null,
  updated_at timestamp default null on update current_timestamp
);
create trigger init_created_at before insert on entries for each row set new.created_at = now();
</pre>
<p>Now whenever a new row is created the trigger will be executed and set the time to the current timestamp. You can forget about the created_at column in your code because it&#8217;s not meant to be changed.</p>
]]></content:encoded>
			<wfw:commentRss>http://seanbehan.com/databases/managing-timestamps-in-mysql-with-a-trigger/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Install do_mysql Ruby Gem on Mac OS X</title>
		<link>http://seanbehan.com/databases/install-do_mysql-ruby-gem-on-mac-os-x/</link>
		<comments>http://seanbehan.com/databases/install-do_mysql-ruby-gem-on-mac-os-x/#comments</comments>
		<pubDate>Wed, 19 Aug 2009 15:19:05 +0000</pubDate>
		<dc:creator>bseanvt</dc:creator>
				<category><![CDATA[Databases]]></category>
		<category><![CDATA[config]]></category>
		<category><![CDATA[datamapper]]></category>
		<category><![CDATA[do_mysql]]></category>
		<category><![CDATA[gems]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[Sinatra]]></category>

		<guid isPermaLink="false">http://seanbehan.com/?p=523</guid>
		<description><![CDATA[I ran into the same problem when installing mysql gem for Rails development. This fix worked for me http://seanbehan.com/programming/fixing-mysql-for-rails-2-2-development-on-mac-os-x/ The same thing works with the data objects gem. Just specify the path the mysql config that it&#8217;s using and the gem should install just fine. gem install do_mysql -- --with-mysql-config=/opt/local/lib/mysql5/bin/mysql_config]]></description>
			<content:encoded><![CDATA[<div style="height:33px;" class="really_simple_share robots-nocontent snap_nopreview"><div class="really_simple_share_facebook_like" style="width:px;">
				<iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fseanbehan.com%2Fdatabases%2Finstall-do_mysql-ruby-gem-on-mac-os-x%2F&amp;layout=button_count&amp;show_faces=false&amp;width=&amp;action=like&amp;colorscheme=light&amp;send=false&amp;height=27" 
						scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:px; height:27px;" allowTransparency="true"></iframe>
				</div><div class="really_simple_share_twitter" style="width:px;">
					<a href="http://twitter.com/share" class="twitter-share-button" data-count="horizontal" 
						data-text="Install do_mysql Ruby Gem on Mac OS X" data-url="http://seanbehan.com/databases/install-do_mysql-ruby-gem-on-mac-os-x/" 
						data-via="" ></a> 
				</div></div>
		<div style="clear:both;"></div><p>I ran into the same problem when installing mysql gem for Rails development. This fix worked for me http://seanbehan.com/programming/fixing-mysql-for-rails-2-2-development-on-mac-os-x/</p>
<p>The same thing works with the data objects gem. Just specify the path the mysql config that it&#8217;s using and the gem should install just fine.</p>
<pre class="wp-code-highlight prettyprint">
gem install do_mysql -- --with-mysql-config=/opt/local/lib/mysql5/bin/mysql_config
</pre>
]]></content:encoded>
			<wfw:commentRss>http://seanbehan.com/databases/install-do_mysql-ruby-gem-on-mac-os-x/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Fixing MySQL for Rails 2.2 Development on Mac OS X</title>
		<link>http://seanbehan.com/programming/fixing-mysql-for-rails-2-2-development-on-mac-os-x/</link>
		<comments>http://seanbehan.com/programming/fixing-mysql-for-rails-2-2-development-on-mac-os-x/#comments</comments>
		<pubDate>Fri, 03 Jul 2009 16:35:50 +0000</pubDate>
		<dc:creator>bseanvt</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[adapter]]></category>
		<category><![CDATA[errors]]></category>
		<category><![CDATA[gems]]></category>
		<category><![CDATA[mac os x]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[Rails]]></category>

		<guid isPermaLink="false">http://seanbehan.com/?p=421</guid>
		<description><![CDATA[Oh what trouble Rails 2.2 and MySQL (on Mac OS X) can be. Rails, as of version >= 2.2, no longer comes bundled with the MySQL adapter. This means you&#8217;ll need to install it yourself, but it appears that the gem for installing it is also broken. This will fail gem install mysql What you [...]]]></description>
			<content:encoded><![CDATA[<div style="height:33px;" class="really_simple_share robots-nocontent snap_nopreview"><div class="really_simple_share_facebook_like" style="width:px;">
				<iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fseanbehan.com%2Fprogramming%2Ffixing-mysql-for-rails-2-2-development-on-mac-os-x%2F&amp;layout=button_count&amp;show_faces=false&amp;width=&amp;action=like&amp;colorscheme=light&amp;send=false&amp;height=27" 
						scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:px; height:27px;" allowTransparency="true"></iframe>
				</div><div class="really_simple_share_twitter" style="width:px;">
					<a href="http://twitter.com/share" class="twitter-share-button" data-count="horizontal" 
						data-text="Fixing MySQL for Rails 2.2 Development on Mac OS X" data-url="http://seanbehan.com/programming/fixing-mysql-for-rails-2-2-development-on-mac-os-x/" 
						data-via="" ></a> 
				</div></div>
		<div style="clear:both;"></div><p>Oh what trouble Rails 2.2 and MySQL (on Mac OS X) can be. Rails, as of version >= 2.2, no longer comes bundled with the MySQL adapter. This means you&#8217;ll need to install it yourself, but it appears that the gem for installing it is also broken.</p>
<p>This will fail</p>
<pre class="wp-code-highlight prettyprint">
gem install mysql
</pre>
<p>What you need to do is tell the gem which MySQL to use. I installed MySQL with mac ports, http://macports.org , so I need to specify this when I run the installation command.</p>
<pre class="wp-code-highlight prettyprint">
gem install mysql -- --with-mysql-config=/opt/local/lib/mysql5/bin/mysql_config
</pre>
<p>Check out an earlier post explaining how to install MySQL with mac ports http://seanbehan.com/programming/installing-sphinx-search-engine-on-mac-os-x-or-ld-library-not-found-for-lmysqlclient/</p>
<p>You&#8217;re not out of the woods yet. Rails needs to know the location of the socket it uses to connect to the MySQL server. I created a symbolic link to the location Rails normally looks for this socket. You could specify the location of the socket in the config/database.yml file, however, then you&#8217;ll need to do this with each of your applications.</p>
<pre class="wp-code-highlight prettyprint">
ln -s /private/tmp/mysql.sock /opt/local/var/run/mysql5/mysqld.sock
</pre>
<p>If there is an easier way to get MySQL back for Rails on Mac OS X please let me know. I&#8217;d love a quick fix to this problem.</p>
]]></content:encoded>
			<wfw:commentRss>http://seanbehan.com/programming/fixing-mysql-for-rails-2-2-development-on-mac-os-x/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

