<?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>D&#039;Arcy Norman dot net &#187; mysql</title>
	<atom:link href="http://www.darcynorman.net/tag/mysql/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.darcynorman.net</link>
	<description>just a lowly edtech geek, mumble mumble university of calgary</description>
	<lastBuildDate>Mon, 22 Mar 2010 04:37:47 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Enterprise-Class WordPress</title>
		<link>http://www.darcynorman.net/2007/05/28/enterprise-class-wordpress/</link>
		<comments>http://www.darcynorman.net/2007/05/28/enterprise-class-wordpress/#comments</comments>
		<pubDate>Mon, 28 May 2007 21:21:53 +0000</pubDate>
		<dc:creator>dnorman</dc:creator>
				<category><![CDATA[general]]></category>
		<category><![CDATA[mysql]]></category>

		<guid isPermaLink="false">http://www.darcynorman.net/2007/05/28/enterprise-class-wordpress/</guid>
		<description><![CDATA[I&#8217;d been thinking that WordPress might be tricky to scale, but between WP-Cache and the newly announced HyperDB, I think WP might well have some legs in it.
WP-Cache stores pages as static files, and dramatically reduces the load on the database. This makes sites more responsive, and at least theoretically able to survive a Slashdotting [...]]]></description>
			<content:encoded><![CDATA[<p></p><p>I&#8217;d been thinking that WordPress might be tricky to scale, but between WP-Cache and the newly announced HyperDB, I think WP might well have some legs in it.</p>
<p><a href="http://mnm.uib.es/gallir/wp-cache-2/">WP-Cache</a> stores pages as static files, and dramatically reduces the load on the database. This makes sites more responsive, and at least theoretically able to survive a Slashdotting or Digging.</p>
<p><a href="http://photomatt.net/2007/05/28/announcing-hyperdb/">Matt just announced</a> the other side of the equation. <a href="http://comox.textdrive.com/pipermail/wp-hackers/2007-May/012893.html">Enterprise-level database connectivity</a>. They&#8217;re releasing the (previously custom) database class that was developed for WordPress.com. It obviously works, as WordPress.com has something like 47 quajillion blogs hosted, with pretty decent performance.</p>
<p>Matt&#8217;s notes on the HyperDB release describe features including:</p>
<ul>
<li>Replication</li>
<li>Failover</li>
<li>Redundant (public/private) networks</li>
<li>Local and remote datacenters</li>
<li>Partitioning</li>
<li>Different tables on different DBs</li>
<li>Advanced stats for profiling</li>
<li>More&#8230;?</li>
</ul>
<p>So, it supports spreading databases across a bunch of servers, making it easier to set up server clusters to scale WordPress (and WPMU) up to any level you want. Might be handy for, oh, I don&#8217;t know&#8230; an institutional blogging platform?</p>
<p>WordPress just got a bunch more interesting, from a CMS perspective&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.darcynorman.net/2007/05/28/enterprise-class-wordpress/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>How to migrate from Drupal 5 to WordPress 2</title>
		<link>http://www.darcynorman.net/2007/05/15/how-to-migrate-from-drupal-5-to-wordpress-2/</link>
		<comments>http://www.darcynorman.net/2007/05/15/how-to-migrate-from-drupal-5-to-wordpress-2/#comments</comments>
		<pubDate>Wed, 16 May 2007 02:03:36 +0000</pubDate>
		<dc:creator>dnorman</dc:creator>
				<category><![CDATA[general]]></category>
		<category><![CDATA[drupal]]></category>
		<category><![CDATA[howto]]></category>
		<category><![CDATA[mysql]]></category>

		<guid isPermaLink="false">http://www.darcynorman.net/2007/05/15/how-to-migrate-from-drupal-5-to-wordpress-2/</guid>
		<description><![CDATA[I migrated my blog from Drupal 5 to WordPress 2 nearly 2 weeks ago. The process wasn&#8217;t as painful as I thought it would be, thanks to a handy howto via vrypan.net. Another resource I refer to every time I get into tweaking MySQL rows is UrbanMainframe&#8217;s MySQL search and replace tipsheet. Thanks to both [...]]]></description>
			<content:encoded><![CDATA[<p></p><p>I migrated my blog from Drupal 5 to WordPress 2 nearly 2 weeks ago. The process wasn&#8217;t as painful as I thought it would be, thanks to a <a href="http://vrypan.net/log/2005/03/10/migrating-from-drupal-to-wordpress/">handy howto via vrypan.net</a>. Another resource I refer to every time I get into tweaking MySQL rows is <a href="http://urbanmainframe.com/folders/blog/20050125/">UrbanMainframe&#8217;s MySQL search and replace tipsheet</a>. Thanks to both of these great resources for helping me through the migration.</p>
<p>This guide is intended only to document what I did. It&#8217;s not a polished howto or manual. There is no warranty. If you blow up your database because you didn&#8217;t work with offline backup copies, I won&#8217;t be able to help you. Actually, if you&#8217;re that silly, I won&#8217;t be willing to help you, either. Your mileage may vary.</p>
<p><strong>Use a backup copy of your Drupal database, and a fresh WordPress database.</strong></p>
<p>The basic process I followed was:</p>
<ol>
<li>Work from offline copies of the databases. Dump your Drupal 5 database, import it into a fresh database (say &#8220;<code>drupalmigration</code>&#8221; or something creative). I did the migration on a separate machine from my &#8220;live&#8221; server &#8211; I used my desktop box, with local copies of MySQL and Apache. Anything with a decent version of MySQL on it will do.</li>
<li><a href="http://wordpress.org/download/">Install WordPress</a>, (you don&#8217;t need to install Drupal for this migration) using the same database server containing the copy of your Drupal database (use &#8220;<code>wordpress</code>&#8221; as the name of the new WordPress database).</li>
<li>Now that you&#8217;ve got WordPress and Drupal running on the same database server, in separate databases, run <a href="http://www.darcynorman.net/files/drupal_to_wordpress.sql" title="Drupal to Wordpress migration script">this MySQL script</a> which I modified slightly after the file provided by vrypan.net. The script assumes the WordPress database is called &#8220;<code>wordpress</code>&#8221; and the Drupal database is called &#8220;<code>drupalmigration</code>&#8221; &#8211; feel free to modify the script to match the database names you need to use, if they differ.</li>
<li>That should do it. Log into your WordPress site. You might have to hand tweak the usernames, but all posts and comments should be there&#8230;</li>
</ol>
<p>One additional thing I had to do was fix the <code>comment_ID</code> values in the <code>wp_comments</code> table. After migration, they were too big for the data type, and things went poopy. I&#8217;m sure there&#8217;s an elegant way to renumber rows in MySQL. I used brute force, by dumping the table to a .sql file and opening that in a text editor to do a search-and-replace to lower the numbers used as primary keys. I then moved the old table out of the way (renaming it to &#8220;<code>wp_comments_old</code>&#8220;) and imported the new <code>wp_comments</code> table definition and content. It was a funky thing to have to do, but it solved all kinds of comment-related misbehaviour.</p>
<p>Test things out in the migrated database. If all seems well, go ahead and dump the <code>wordpress</code> database to a .sql file, and import it into a new database on your server. Install and configure WordPress on your server to use this new database. You may need to manually change the URL used by the blog, so that it matches the &#8220;live&#8221; server rather than whatever you used as a staging/migration server. The values are in the <code>wp_options</code> table, with <code>option_name</code> of &#8220;<code>siteurl</code>&#8221; and &#8220;<code>home</code>&#8221; &#8211; change those values to whatever matches the root URL for your blog.</p>
<p>You&#8217;ll also have to make sure all files are in the proper place, so URL references from the old Drupal content doesn&#8217;t point off to 404 error pages. That&#8217;s an exercise left to the reader. I just SSHed into my server and used a lot of <code>cp -R drupal/directoryname wordpress/directoryname</code> &#8211; being paranoidally careful to copy files rather than just moving them. Always keep backups.</p>
<p><strong>Update</strong>: I&#8217;ve updated the SQL script to automatically set the comment and category counts, so it should appear to work better now.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.darcynorman.net/2007/05/15/how-to-migrate-from-drupal-5-to-wordpress-2/feed/</wfw:commentRss>
		<slash:comments>65</slash:comments>
		</item>
		<item>
		<title>Help &#8211; Slow MySQL Insert?</title>
		<link>http://www.darcynorman.net/2006/11/14/help-slow-mysql-insert/</link>
		<comments>http://www.darcynorman.net/2006/11/14/help-slow-mysql-insert/#comments</comments>
		<pubDate>Wed, 31 Dec 1969 17:00:00 +0000</pubDate>
		<dc:creator>dnorman</dc:creator>
				<category><![CDATA[database]]></category>
		<category><![CDATA[drupal]]></category>
		<category><![CDATA[lazyweb]]></category>
		<category><![CDATA[mysql]]></category>

		<guid isPermaLink="false">1110631599</guid>
		<description><![CDATA[I've been struggling with this for what feels like months. On a project, we're using a third party hosting provider, who offers us space on a managed server, complete with everything we need to run Drupal in a shared hosting environment. We're running a copy of Provisionator on the server to help us deploy lots of Drupal sites easily.<br /><br />Here's where it gets messy. We can create new databases just fine, but importing a .sql file takes for freaking ever. Imports that take 3 seconds on my Powerbook can take 90 - 300 seconds on this server. Running the import on a dual G5 XServe with the same version of MySQL finishes the job in about a second.<br /><br />I've tried removing variables from the equation. Using full-on Provisionator. Using a separate custom .php script. Using phpMyAdmin. Each take so long that browsers often time out before completing the import (leaving partially imported databases). I've tried command line mysql directly on the server, with the same range of very slow times.<br /><br />I can't seem to find anything that might make imports of a smallish .sql (~400K) file take so long. Unfortunately, it's making the process of deploying new sites essentially useless for now.<br /><br />The curious thing is that once a database has (eventually) been populated, the select queries seem to run at normalish speed.<br /><br />Any ideas on how to get the server back up to speed? It's running MySQL 4.1.20 with MyISAM tables on a RedHat Linux box. I don't have access to tools like top, ps, netstat, or even env, so exact details of the box's config are shrouded in a veil of mystery and obscurity.<br />]]></description>
			<content:encoded><![CDATA[<p></p><p>I&#8217;ve been struggling with this for what feels like months. On a project, we&#8217;re using a third party hosting provider, who offers us space on a managed server, complete with everything we need to run Drupal in a shared hosting environment. We&#8217;re running a copy of Provisionator on the server to help us deploy lots of Drupal sites easily.</p>
<p>Here&#8217;s where it gets messy. We can create new databases just fine, but importing a .sql file takes for freaking ever. Imports that take 3 seconds on my Powerbook can take 90 &#8211; 300 seconds on this server. Running the import on a dual G5 XServe with the same version of MySQL finishes the job in about a second.</p>
<p>I&#8217;ve tried removing variables from the equation. Using full-on Provisionator. Using a separate custom .php script. Using phpMyAdmin. Each take so long that browsers often time out before completing the import (leaving partially imported databases). I&#8217;ve tried command line mysql directly on the server, with the same range of very slow times.</p>
<p>I can&#8217;t seem to find anything that might make imports of a smallish .sql (~400K) file take so long. Unfortunately, it&#8217;s making the process of deploying new sites essentially useless for now.</p>
<p>The curious thing is that once a database has (eventually) been populated, the select queries seem to run at normalish speed.</p>
<p>Any ideas on how to get the server back up to speed? It&#8217;s running MySQL 4.1.20 with MyISAM tables on a RedHat Linux box. I don&#8217;t have access to tools like top, ps, netstat, or even env, so exact details of the box&#8217;s config are shrouded in a veil of mystery and obscurity.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.darcynorman.net/2006/11/14/help-slow-mysql-insert/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Estimating blog feed subscribers in Drupal</title>
		<link>http://www.darcynorman.net/2006/08/15/estimating-blog-feed-subscribers-in-drupal/</link>
		<comments>http://www.darcynorman.net/2006/08/15/estimating-blog-feed-subscribers-in-drupal/#comments</comments>
		<pubDate>Wed, 31 Dec 1969 17:00:00 +0000</pubDate>
		<dc:creator>dnorman</dc:creator>
				<category><![CDATA[drupal]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[rss]]></category>
		<category><![CDATA[statistics]]></category>

		<guid isPermaLink="false">1229415871</guid>
		<description><![CDATA[Guesstimating the size of an RSS feed audience is always a huge shot in the dark, but sometimes I get curious about how many people subscribe to this silly blog. If I was willing to surrender my feeds to Feedburner, I could get some pretty detailed stats. But, I don't want to hand over that.

So, I thought about digging into the accesslog that's stored in Drupal's database. I've set my copy to store access logs for the past 2 weeks, and it dutifully records which pages are viewed, as well as the IP address the request came from. It's just a subset of a typical webserver log, so there isn't any privacy issue here (if you're really worried about being tracked online, you're already using an anonymizing proxy...)

A quick MySQL poke-and-test session, and I came up with a quick query that spits out a WAG about the number of feed subscribers. It's not accurate, because people might be accessing the feed from multiple locations (recording different IP addresses), and services like Bloglines might be sending many readers in under the cover of a single IP address (at the moment, Bloglines claims 334 folks are subscribing to various feeds published by this blog). Also, it makes no distinction between bots (Google and friends) and actual human-proxying-agents. Whatever.

Here's my brain-dead-simple query. It just looks for all requests for feed-related paths, and counts up the number of unique IP addresses.

<pre><code>select count(distinct hostname) from accesslog where path like '%/feed%'</code></pre>

YMMV. IANAP. YHBH. Wait. Not the last one.

According to my Drupal log, there have been 955 unique IP addresses requesting the RSS/atom feeds on this blog in the last 2 weeks. That may be higher or lower than the number of actual humans reading the blog. Still, ballpark order-of-magnitude WAG at roughly 1,000. That kind of boggles my mind.

<strong>Update</strong>: Oops. My rudimentary query forgot subscribers of "rss.xml" - which turned out to be more than the various /feed subscribers! Also, thanks to a tip from <a href="http://www.webschuur.com/">Bér Kessels</a>, I added the cool <a href="http://drupal.org/project/xstatistics">XStatistics module</a>, which takes care of the guesswork. According to it, there are 2062 subscribers to the various feeds on this blog. Wow.]]></description>
			<content:encoded><![CDATA[<p></p><p>Guesstimating the size of an RSS feed audience is always a huge shot in the dark, but sometimes I get curious about how many people subscribe to this silly blog. If I was willing to surrender my feeds to Feedburner, I could get some pretty detailed stats. But, I don&#8217;t want to hand over that.</p>
<p>So, I thought about digging into the accesslog that&#8217;s stored in Drupal&#8217;s database. I&#8217;ve set my copy to store access logs for the past 2 weeks, and it dutifully records which pages are viewed, as well as the IP address the request came from. It&#8217;s just a subset of a typical webserver log, so there isn&#8217;t any privacy issue here (if you&#8217;re really worried about being tracked online, you&#8217;re already using an anonymizing proxy&#8230;)</p>
<p>A quick MySQL poke-and-test session, and I came up with a quick query that spits out a WAG about the number of feed subscribers. It&#8217;s not accurate, because people might be accessing the feed from multiple locations (recording different IP addresses), and services like Bloglines might be sending many readers in under the cover of a single IP address (at the moment, Bloglines claims 334 folks are subscribing to various feeds published by this blog). Also, it makes no distinction between bots (Google and friends) and actual human-proxying-agents. Whatever.</p>
<p>Here&#8217;s my brain-dead-simple query. It just looks for all requests for feed-related paths, and counts up the number of unique IP addresses.</p>
<pre><code>select count(distinct hostname) from accesslog where path like '%/feed%'</code></pre>
<p>YMMV. IANAP. YHBH. Wait. Not the last one.</p>
<p>According to my Drupal log, there have been 955 unique IP addresses requesting the RSS/atom feeds on this blog in the last 2 weeks. That may be higher or lower than the number of actual humans reading the blog. Still, ballpark order-of-magnitude WAG at roughly 1,000. That kind of boggles my mind.</p>
<p><strong>Update</strong>: Oops. My rudimentary query forgot subscribers of &#8220;rss.xml&#8221; &#8211; which turned out to be more than the various /feed subscribers! Also, thanks to a tip from <a href="http://www.webschuur.com/">Bér Kessels</a>, I added the cool <a href="http://drupal.org/project/xstatistics">XStatistics module</a>, which takes care of the guesswork. According to it, there are 2062 subscribers to the various feeds on this blog. Wow.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.darcynorman.net/2006/08/15/estimating-blog-feed-subscribers-in-drupal/feed/</wfw:commentRss>
		<slash:comments>12</slash:comments>
		</item>
		<item>
		<title>Upgrading MySQL on MacOSX Server</title>
		<link>http://www.darcynorman.net/2006/06/22/upgrading-mysql-on-macosx-server/</link>
		<comments>http://www.darcynorman.net/2006/06/22/upgrading-mysql-on-macosx-server/#comments</comments>
		<pubDate>Wed, 31 Dec 1969 17:00:00 +0000</pubDate>
		<dc:creator>dnorman</dc:creator>
				<category><![CDATA[mysql]]></category>
		<category><![CDATA[server]]></category>

		<guid isPermaLink="false">1409305705</guid>
		<description><![CDATA[<p>I just upgraded our TLC development/staging/small-deployment server from MySQL 4.0 to 5.0.22. I&#39;d never upgraded a MySQL server before (always just installed a fresh copy on a new box, or updated along with MacOSX) so I wanted to do some testing before making the plunge on a deployment server. We&#39;ve got a bunch of databases on that box, running everything from weblogs.ucalgary.ca to some custom apps written here.</p><p>I did a quick <a href="http://dev.mysql.com/doc/refman/5.0/en/upgrade.html">RTFM</a> , but the MySQL manual recommended not jumping right from 4.0 to 5.0 using the normal upgrade process. It said to go to 4.1 first, then to 5.0. So, I did some more Googling, and realized that a full mysqldump and restore would do the trick, without requiring the milk run through 4.1.<br /></p><p>I installed a fresh copy of <a href="http://dev.mysql.com/downloads/mysql/5.0.html">MySQL 5.0.x</a>  on my desktop box, did a full mysqldump from the server using:</p><p><code>mysqldump -u root -p --opt -Q --add-drop-table &#62; mysqldump.sql</code></p><p>That gave me a 400+MB SQL file, handy for a backup, or for migrating between copies of MySQL. I copied the file to my desktop, and ran this:</p><p><code>mysql -u root -p &#60; mysqldump.sql</code></p><p><code>mysqladmin -u root -p --flush-privileges</code></p><p>And, it Just Worked™ - so the data should safely migrate this way. I did some testing with apps - Drupal etc... and thinks behaved as expected. It takes longer to dump/restore than just updating the MySQL server, but it&#39;s safe. And all database users and privileges were intact, so everything should hook up just fine.<br /></p><p>Then, I did the same on the server. I killed MySQL, which was still running version 4.0. I ran the installer (both MySQL 5.0 and the StartupItem) via SSH (sudo installer...) and it took care of setting stuff up. But, the old MySQL didn&#39;t shutdown cleanly, so I had to do the unthinkable - reboot the box. I know there&#39;s a cleaner, more &#34;official&#34; way to clean stuff up, but the box had been up for a couple months, so a reboot wasn&#39;t the end of the world.</p><p>When the server came back up, MySQL was running as expected. Then, it was a simple. First, I told my shell to use the new copy of MySQL, then imported the data:</p><p><code>alias mysql=/usr/local/mysql/bin/mysql</code></p><p><code>alias mysqladmin=/usr/local/mysql/bin/mysqladmin</code></p><p><code>mysql -u root -p &#60; mysql.sql</code></p><p><code>mysqladmin -u root -p --flush-privileges</code></p><p>And all of our apps are up and running on a shiny new copy of MySQL. The previous version of MySQL is still on the server (but not running) with all data still safe in its own directory, so if something catastrophic has happened, reverting will be trivial. </p><p>Now, to upgrade my copy of Moodle to 1.6, which is what prompted the whole MySQL upgrade process in the first place... </p>]]></description>
			<content:encoded><![CDATA[<p></p><p>I just upgraded our TLC development/staging/small-deployment server from MySQL 4.0 to 5.0.22. I&#39;d never upgraded a MySQL server before (always just installed a fresh copy on a new box, or updated along with MacOSX) so I wanted to do some testing before making the plunge on a deployment server. We&#39;ve got a bunch of databases on that box, running everything from weblogs.ucalgary.ca to some custom apps written here.</p>
<p>I did a quick <a href="http://dev.mysql.com/doc/refman/5.0/en/upgrade.html">RTFM</a> , but the MySQL manual recommended not jumping right from 4.0 to 5.0 using the normal upgrade process. It said to go to 4.1 first, then to 5.0. So, I did some more Googling, and realized that a full mysqldump and restore would do the trick, without requiring the milk run through 4.1.</p>
<p>I installed a fresh copy of <a href="http://dev.mysql.com/downloads/mysql/5.0.html">MySQL 5.0.x</a>  on my desktop box, did a full mysqldump from the server using:</p>
<p><code>mysqldump -u root -p --opt -Q --add-drop-table &gt; mysqldump.sql</code></p>
<p>That gave me a 400+MB SQL file, handy for a backup, or for migrating between copies of MySQL. I copied the file to my desktop, and ran this:</p>
<p><code>mysql -u root -p &lt; mysqldump.sql</code></p>
<p><code>mysqladmin -u root -p --flush-privileges</code></p>
<p>And, it Just Worked™ &#8211; so the data should safely migrate this way. I did some testing with apps &#8211; Drupal etc&#8230; and thinks behaved as expected. It takes longer to dump/restore than just updating the MySQL server, but it&#39;s safe. And all database users and privileges were intact, so everything should hook up just fine.</p>
<p>Then, I did the same on the server. I killed MySQL, which was still running version 4.0. I ran the installer (both MySQL 5.0 and the StartupItem) via SSH (sudo installer&#8230;) and it took care of setting stuff up. But, the old MySQL didn&#39;t shutdown cleanly, so I had to do the unthinkable &#8211; reboot the box. I know there&#39;s a cleaner, more &quot;official&quot; way to clean stuff up, but the box had been up for a couple months, so a reboot wasn&#39;t the end of the world.</p>
<p>When the server came back up, MySQL was running as expected. Then, it was a simple. First, I told my shell to use the new copy of MySQL, then imported the data:</p>
<p><code>alias mysql=/usr/local/mysql/bin/mysql</code></p>
<p><code>alias mysqladmin=/usr/local/mysql/bin/mysqladmin</code></p>
<p><code>mysql -u root -p &lt; mysql.sql</code></p>
<p><code>mysqladmin -u root -p --flush-privileges</code></p>
<p>And all of our apps are up and running on a shiny new copy of MySQL. The previous version of MySQL is still on the server (but not running) with all data still safe in its own directory, so if something catastrophic has happened, reverting will be trivial. </p>
<p>Now, to upgrade my copy of Moodle to 1.6, which is what prompted the whole MySQL upgrade process in the first place&#8230; </p>
]]></content:encoded>
			<wfw:commentRss>http://www.darcynorman.net/2006/06/22/upgrading-mysql-on-macosx-server/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>More on MySQL backups</title>
		<link>http://www.darcynorman.net/2006/03/15/more-on-mysql-backups/</link>
		<comments>http://www.darcynorman.net/2006/03/15/more-on-mysql-backups/#comments</comments>
		<pubDate>Wed, 31 Dec 1969 17:00:00 +0000</pubDate>
		<dc:creator>dnorman</dc:creator>
				<category><![CDATA[backup]]></category>
		<category><![CDATA[mysql]]></category>

		<guid isPermaLink="false">2049584337</guid>
		<description><![CDATA[I'm just putting some additional refinements to my automated server backup process, and have rolled together a handy script to backup each database into its own backup file (so I can restore a single database, rather than blowing them all away to restore from an <code>--all-databases</code> backup.

I'm going to work on making a fancier / more dynamic script based on MySOL's <code>show databases</code> command to get all databases backed up individually without having to remember to add them to the backup script. In the meantime, here's how I'm backing up my databases.

In a script creatively named "<code>backup_databases.sh</code>" - which has been added to the crontab on the server - I have this:
<strong>Update</strong>: A <em>much</em> better script was provided in the comments for this post. Definitely use that one rather than this one that I cobbled together. I'm leaving this script up in case it comes in handy, but have switched my servers to use the script provided by Jon.

<pre><code>#!/bin/sh
# Customize these variables to match what you have
MYSQL_ACCOUNT=root
MYSQL_PASSWORD=password
BACKUP_DIRECTORY="/Users/Shared/backup/mysql/"

backupdb() {
    DATABASE_NAME=$1
    FILE_NAME=${2:-$DATABASE_NAME}
    echo "dumping database " $DATABASE_NAME " to " $FILE_NAME
    /usr/bin/mysqldump -u $MYSQL_ACCOUNT -p$MYSQL_PASSWORD -q $DATABASE_NAME &#124; gzip > $BACKUP_DIRECTORY$FILE_NAME.sql.gz
}

# add lines for each database you want to back up
backupdb "first_database"
backupdb "database2"

# keep adding databases...

# finish up by grabbing the whole works Just In Case
backupdb "--all-databases" "mysqldump" </code></pre>

The script has a function that is called for each database you want to back up, passing in the database name, and optionally the name of the output file. I'll be tweaking the script over the next few days to make it more robust and flexible, but it's a decent starting point anyway.

Of course, if you don't need to restore individual databases, you can simply call
<code>mysqldump -u USER -pPASSWORD -q --all-databases &#124; gzip > mysqldump.sql.gz</code>

<strong>Update</strong>: A much better, more flexible, and robust script was provided by Jon in the comments for this post. I'm using that script now. Thanks!]]></description>
			<content:encoded><![CDATA[<p></p><p>I&#8217;m just putting some additional refinements to my automated server backup process, and have rolled together a handy script to backup each database into its own backup file (so I can restore a single database, rather than blowing them all away to restore from an <code>--all-databases</code> backup.</p>
<p>I&#8217;m going to work on making a fancier / more dynamic script based on MySOL&#8217;s <code>show databases</code> command to get all databases backed up individually without having to remember to add them to the backup script. In the meantime, here&#8217;s how I&#8217;m backing up my databases.</p>
<p>In a script creatively named &#8220;<code>backup_databases.sh</code>&#8221; &#8211; which has been added to the crontab on the server &#8211; I have this:<br />
<strong>Update</strong>: A <em>much</em> better script was provided in the comments for this post. Definitely use that one rather than this one that I cobbled together. I&#8217;m leaving this script up in case it comes in handy, but have switched my servers to use the script provided by Jon.</p>
<pre><code>#!/bin/sh
# Customize these variables to match what you have
MYSQL_ACCOUNT=root
MYSQL_PASSWORD=password
BACKUP_DIRECTORY="/Users/Shared/backup/mysql/"

backupdb() {
    DATABASE_NAME=$1
    FILE_NAME=${2:-$DATABASE_NAME}
    echo "dumping database " $DATABASE_NAME " to " $FILE_NAME
    /usr/bin/mysqldump -u $MYSQL_ACCOUNT -p$MYSQL_PASSWORD -q $DATABASE_NAME | gzip > $BACKUP_DIRECTORY$FILE_NAME.sql.gz
}

# add lines for each database you want to back up
backupdb "first_database"
backupdb "database2"

# keep adding databases...

# finish up by grabbing the whole works Just In Case
backupdb "--all-databases" "mysqldump" </code></pre>
<p>The script has a function that is called for each database you want to back up, passing in the database name, and optionally the name of the output file. I&#8217;ll be tweaking the script over the next few days to make it more robust and flexible, but it&#8217;s a decent starting point anyway.</p>
<p>Of course, if you don&#8217;t need to restore individual databases, you can simply call<br />
<code>mysqldump -u USER -pPASSWORD -q --all-databases | gzip > mysqldump.sql.gz</code></p>
<p><strong>Update</strong>: A much better, more flexible, and robust script was provided by Jon in the comments for this post. I&#8217;m using that script now. Thanks!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.darcynorman.net/2006/03/15/more-on-mysql-backups/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>B2 to WordPress Migration is Not Smooth</title>
		<link>http://www.darcynorman.net/2005/10/09/b2-to-wordpress-migration-is-not-smooth/</link>
		<comments>http://www.darcynorman.net/2005/10/09/b2-to-wordpress-migration-is-not-smooth/#comments</comments>
		<pubDate>Wed, 31 Dec 1969 17:00:00 +0000</pubDate>
		<dc:creator>dnorman</dc:creator>
				<category><![CDATA[general]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[weblogs]]></category>

		<guid isPermaLink="false">952524901</guid>
		<description><![CDATA[A friend of mine wanted to migrate from an aging B2 installation to a shiny new WordPress setup. I figured it should be a simple process, given that WP was spawned from B2's loins and all. It should have been relatively trivial - tweak some database fields, massage some data, and done. Not so fast, smartass.

Turns out that all of the tips I found were, well, a bit short. They either didn't work at all, or sorta worked, but not enough to be useful. Crap. So, I started eyeballing the B2 schema. Turns out the biggest difference between the B2 tables and the WP tables is - wait for it - the table names. Aside from that, it's some trivial stuff like changing int into bigint, etc...

So, here's the process I followed. <strong>Update</strong> - this didn't work, after all... read down to the bottom for the steps that <em>did</em> work.

<ol>
<li>Install WordPress on my Powerbook. Create a new database for it.</li>
<li>Import the B2 database into a new database on my Powerbook.</li>
<li>Massage the imported B2 database - change table names to match WP, and make all fields to match what's expected by WP. I used CocoaMySQL because it rocks so much.</li>
<li>Dump the data from the imported/modified database.</li>
<li>Import the mysqldump of massaged B2 data into the shiny new WP database.</li>
<li>Verify that it's working in WP.</li>
<li>Mysqldump the shiny new WP database, and import it into the database server used by my friend.</li>
<li>Cross fingers and hope it works fine on his server...</li>
</ol>

Now, why on earth doesn't the stock "import-b2.php" file included with WordPress not just take care of this? I tried it, and it barfed miserably. I tried several other documented techniques, and they barfed equally violently. Manual tweakage appears to have worked.

Hopefully, he'll have the blog up and running by the end of the weekend. At least he'll be spared manual copy-and-paste operations to import the nearly 90 posts in his database, as well as the comments...

<strong>Update</strong>: OK. The manual tweak basically didn't work after all. I ended up starting over from scratch (again), following the instructions <a href="http://www.wild-mind.net/archives/2004/09/12/changing-from-b2-to-wordpress/">here</a>, followed by an additional call to update.php, and it appears all is well.

So, the <em>real</em> B2-->WP migration process that worked here is:
<ol>
<li>Backup the B2 tables into a fresh database - call it something creative like "b2migration" or something.</li>
<li>Install WordPress, using the "b2migration" database to store the automatically-created WordPress tables.</li>
<li>Follow <a href="http://www.wild-mind.net/archives/2004/09/12/changing-from-b2-to-wordpress/">the instructions</a>, essentially running this on "b2migration" database:
<pre><code>DROP TABLE wp_categories;
DROP TABLE wp_comments;
DROP TABLE wp_posts;
DROP TABLE wp_settings;
DROP TABLE wp_users;
RENAME TABLE b2categories TO wp_categories;
RENAME TABLE b2comments TO wp_comments;
RENAME TABLE b2posts TO wp_posts;
RENAME TABLE b2settings TO wp_settings;
RENAME TABLE b2users TO wp_users;</code></pre></li>
<li>Run /wp-admin/import-b2.php</li>
<li>Run /wp-admin/upgrade.php</li>
<li>Dump the tables and move them wherever you need them - you didn't do this on your <em>live</em> database, did you?</li>
</ol>]]></description>
			<content:encoded><![CDATA[<p></p><p>A friend of mine wanted to migrate from an aging B2 installation to a shiny new WordPress setup. I figured it should be a simple process, given that WP was spawned from B2&#8217;s loins and all. It should have been relatively trivial &#8211; tweak some database fields, massage some data, and done. Not so fast, smartass.</p>
<p>Turns out that all of the tips I found were, well, a bit short. They either didn&#8217;t work at all, or sorta worked, but not enough to be useful. Crap. So, I started eyeballing the B2 schema. Turns out the biggest difference between the B2 tables and the WP tables is &#8211; wait for it &#8211; the table names. Aside from that, it&#8217;s some trivial stuff like changing int into bigint, etc&#8230;</p>
<p>So, here&#8217;s the process I followed. <strong>Update</strong> &#8211; this didn&#8217;t work, after all&#8230; read down to the bottom for the steps that <em>did</em> work.</p>
<ol>
<li>Install WordPress on my Powerbook. Create a new database for it.</li>
<li>Import the B2 database into a new database on my Powerbook.</li>
<li>Massage the imported B2 database &#8211; change table names to match WP, and make all fields to match what&#8217;s expected by WP. I used CocoaMySQL because it rocks so much.</li>
<li>Dump the data from the imported/modified database.</li>
<li>Import the mysqldump of massaged B2 data into the shiny new WP database.</li>
<li>Verify that it&#8217;s working in WP.</li>
<li>Mysqldump the shiny new WP database, and import it into the database server used by my friend.</li>
<li>Cross fingers and hope it works fine on his server&#8230;</li>
</ol>
<p>Now, why on earth doesn&#8217;t the stock &#8220;import-b2.php&#8221; file included with WordPress not just take care of this? I tried it, and it barfed miserably. I tried several other documented techniques, and they barfed equally violently. Manual tweakage appears to have worked.</p>
<p>Hopefully, he&#8217;ll have the blog up and running by the end of the weekend. At least he&#8217;ll be spared manual copy-and-paste operations to import the nearly 90 posts in his database, as well as the comments&#8230;</p>
<p><strong>Update</strong>: OK. The manual tweak basically didn&#8217;t work after all. I ended up starting over from scratch (again), following the instructions <a href="http://www.wild-mind.net/archives/2004/09/12/changing-from-b2-to-wordpress/">here</a>, followed by an additional call to update.php, and it appears all is well.</p>
<p>So, the <em>real</em> B2&#8211;>WP migration process that worked here is:</p>
<ol>
<li>Backup the B2 tables into a fresh database &#8211; call it something creative like &#8220;b2migration&#8221; or something.</li>
<li>Install WordPress, using the &#8220;b2migration&#8221; database to store the automatically-created WordPress tables.</li>
<li>Follow <a href="http://www.wild-mind.net/archives/2004/09/12/changing-from-b2-to-wordpress/">the instructions</a>, essentially running this on &#8220;b2migration&#8221; database:
<pre><code>DROP TABLE wp_categories;
DROP TABLE wp_comments;
DROP TABLE wp_posts;
DROP TABLE wp_settings;
DROP TABLE wp_users;
RENAME TABLE b2categories TO wp_categories;
RENAME TABLE b2comments TO wp_comments;
RENAME TABLE b2posts TO wp_posts;
RENAME TABLE b2settings TO wp_settings;
RENAME TABLE b2users TO wp_users;</code></pre>
</li>
<li>Run /wp-admin/import-b2.php</li>
<li>Run /wp-admin/upgrade.php</li>
<li>Dump the tables and move them wherever you need them &#8211; you didn&#8217;t do this on your <em>live</em> database, did you?</li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://www.darcynorman.net/2005/10/09/b2-to-wordpress-migration-is-not-smooth/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Godaddy Database Goofup</title>
		<link>http://www.darcynorman.net/2005/10/07/godaddy-database-goofup/</link>
		<comments>http://www.darcynorman.net/2005/10/07/godaddy-database-goofup/#comments</comments>
		<pubDate>Wed, 31 Dec 1969 17:00:00 +0000</pubDate>
		<dc:creator>dnorman</dc:creator>
				<category><![CDATA[database]]></category>
		<category><![CDATA[godaddy]]></category>
		<category><![CDATA[hosting]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[rants]]></category>
		<category><![CDATA[weblog]]></category>

		<guid isPermaLink="false">605060142</guid>
		<description><![CDATA[So, it's 4:50pm Friday afternoon. I'm about to click "Publish" on a post about the random image rotator dealie. Boom. WordPress throws up a big old "Error establishing a database connection" error screen. Crap.

I login to my Godaddy account page, hit the database manager, and PHPMyAdmin can connect. The database is there, and running. WTF. I notice my ShortStat table has ballooned to over 100MB of data. That's insane, so I truncate it. I'll remove the plugin. I check again - maybe I was over my DB quota or something - and it's still no joy from WP.  I try Referrer Karma - it uses the same MySQL database, and throws a scarier - but more helpful - error message. "Warning: mysql_connect(): User 'dnorman' has exceeded the 'max_connections' resource (current value: 50)"

Ahah! Something wrong with the database server. But... I haven't added any new apps or anything, and am in a relatively low traffic load (compared to, say the week of WWDC), so my blog shouldn't be crippling the database server.

I decide to go to the GoDaddy support page - they'll have a "Status" section that indicates that Apache is up, MySQL is up, etc... Right? No. OK, So I fill in the email form, even though it says they won't be able to respond to email for an estimated 10 hours. About 1 minute after clicking "Send", I break into a cold sweat.

My blog is dead in the water. So, I call their phone support line. In the back of my head, I'm thinking "So, this is how they keep their rates so low - I'll get gouged on long distance support, since they don't offer a toll-free line." At least it isn't a 1-900 number or anything. I get connected, pass through voicemail menu hell (why does it ask me to type in my account number if the person who eventually picks up will just be asking me to repeat it anyway?). I eventually get through, and the support tech is nice enough. He doesn't know what's wrong, but would I mind if he put me on hold while he goes to talk to someone with a clue? Sure. The hold music doesn't suck.

13 minutes on the phone, long distance, to GoDaddy tech support. Only to hear "oh, yeah. that's a known issue. They've got their wrenches and hammers out, and are working on it. It should only be a couple of hours. Uh, yeah, your data is probably safe. Can I send you an email survey so you can let us know you were satisfied with this call?"

3 hours later, and it looks like things are back up and running. How about sending me a survey about <strong>that</strong>?]]></description>
			<content:encoded><![CDATA[<p></p><p>So, it&#8217;s 4:50pm Friday afternoon. I&#8217;m about to click &#8220;Publish&#8221; on a post about the random image rotator dealie. Boom. WordPress throws up a big old &#8220;Error establishing a database connection&#8221; error screen. Crap.</p>
<p>I login to my Godaddy account page, hit the database manager, and PHPMyAdmin can connect. The database is there, and running. WTF. I notice my ShortStat table has ballooned to over 100MB of data. That&#8217;s insane, so I truncate it. I&#8217;ll remove the plugin. I check again &#8211; maybe I was over my DB quota or something &#8211; and it&#8217;s still no joy from WP.  I try Referrer Karma &#8211; it uses the same MySQL database, and throws a scarier &#8211; but more helpful &#8211; error message. &#8220;Warning: mysql_connect(): User &#8216;dnorman&#8217; has exceeded the &#8216;max_connections&#8217; resource (current value: 50)&#8221;</p>
<p>Ahah! Something wrong with the database server. But&#8230; I haven&#8217;t added any new apps or anything, and am in a relatively low traffic load (compared to, say the week of WWDC), so my blog shouldn&#8217;t be crippling the database server.</p>
<p>I decide to go to the GoDaddy support page &#8211; they&#8217;ll have a &#8220;Status&#8221; section that indicates that Apache is up, MySQL is up, etc&#8230; Right? No. OK, So I fill in the email form, even though it says they won&#8217;t be able to respond to email for an estimated 10 hours. About 1 minute after clicking &#8220;Send&#8221;, I break into a cold sweat.</p>
<p>My blog is dead in the water. So, I call their phone support line. In the back of my head, I&#8217;m thinking &#8220;So, this is how they keep their rates so low &#8211; I&#8217;ll get gouged on long distance support, since they don&#8217;t offer a toll-free line.&#8221; At least it isn&#8217;t a 1-900 number or anything. I get connected, pass through voicemail menu hell (why does it ask me to type in my account number if the person who eventually picks up will just be asking me to repeat it anyway?). I eventually get through, and the support tech is nice enough. He doesn&#8217;t know what&#8217;s wrong, but would I mind if he put me on hold while he goes to talk to someone with a clue? Sure. The hold music doesn&#8217;t suck.</p>
<p>13 minutes on the phone, long distance, to GoDaddy tech support. Only to hear &#8220;oh, yeah. that&#8217;s a known issue. They&#8217;ve got their wrenches and hammers out, and are working on it. It should only be a couple of hours. Uh, yeah, your data is probably safe. Can I send you an email survey so you can let us know you were satisfied with this call?&#8221;</p>
<p>3 hours later, and it looks like things are back up and running. How about sending me a survey about <strong>that</strong>?</p>
]]></content:encoded>
			<wfw:commentRss>http://www.darcynorman.net/2005/10/07/godaddy-database-goofup/feed/</wfw:commentRss>
		<slash:comments>15</slash:comments>
		</item>
		<item>
		<title>WordPress Database Backup Plugin</title>
		<link>http://www.darcynorman.net/2005/07/14/wordpress-database-backup-plugin/</link>
		<comments>http://www.darcynorman.net/2005/07/14/wordpress-database-backup-plugin/#comments</comments>
		<pubDate>Wed, 31 Dec 1969 17:00:00 +0000</pubDate>
		<dc:creator>dnorman</dc:creator>
				<category><![CDATA[general]]></category>
		<category><![CDATA[mysql]]></category>

		<guid isPermaLink="false">685407004</guid>
		<description><![CDATA[One thing that has been bugging me since moving my blog to <a href="http://www.godaddy.com">GoDaddy</a> for hosting, is the PITA that MySQL backups have become.  Back when I was on the Learning Commons' webserver, I could just create a crontask to dump the MySQL tables every morning. No SSH or shell access to my GoDaddy account means using a web interface to backup, which is less than automatable.

WordPress to the rescue! There's a <a href="http://www.skippy.net/blog/2005/07/12/wordpress-database-backup/">WordPress Database Backup Plugin</a> that can easily download or email database backups to you, and when tied with <a href="http://www.skippy.net/blog/category/wordpress/plugins/wp-cron/">WP-Cron</a> (a cron-like plugin for automating stuff), it's fully automatable! I now have daily database backups gzipped and emailed to my GMail account for safe keeping.

I heart WordPress...]]></description>
			<content:encoded><![CDATA[<p></p><p>One thing that has been bugging me since moving my blog to <a href="http://www.godaddy.com">GoDaddy</a> for hosting, is the PITA that MySQL backups have become.  Back when I was on the Learning Commons&#8217; webserver, I could just create a crontask to dump the MySQL tables every morning. No SSH or shell access to my GoDaddy account means using a web interface to backup, which is less than automatable.</p>
<p>WordPress to the rescue! There&#8217;s a <a href="http://www.skippy.net/blog/2005/07/12/wordpress-database-backup/">WordPress Database Backup Plugin</a> that can easily download or email database backups to you, and when tied with <a href="http://www.skippy.net/blog/category/wordpress/plugins/wp-cron/">WP-Cron</a> (a cron-like plugin for automating stuff), it&#8217;s fully automatable! I now have daily database backups gzipped and emailed to my GMail account for safe keeping.</p>
<p>I heart WordPress&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.darcynorman.net/2005/07/14/wordpress-database-backup-plugin/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>MySQL on MacOSX 10.3 Panther Server</title>
		<link>http://www.darcynorman.net/2004/01/09/mysql-on-macosx-10-3-panther-server/</link>
		<comments>http://www.darcynorman.net/2004/01/09/mysql-on-macosx-10-3-panther-server/#comments</comments>
		<pubDate>Wed, 31 Dec 1969 17:00:00 +0000</pubDate>
		<dc:creator>dnorman</dc:creator>
				<category><![CDATA[mysql]]></category>

		<guid isPermaLink="false">1465358186</guid>
		<description><![CDATA[<p>Boy, was <a href="http://jade.mcli.dist.maricopa.edu/alan/">Alan</a> right... Don't use the version of MySQL (4.0.16) that comes prepackaged in MacOSX 10.3 Server. Man, does it stink.</p>

<p>Update to 4.0.17, using the handy dandy installer provided on MySQL.com/downloads   - it works great, and even starts on boot (unlike the version that comes with panther...)  Just bit the bullet and updated versions on careo.ucalgary.ca, and the weird database behaviour has apparently disappeared.</p>]]></description>
			<content:encoded><![CDATA[<p></p><p>Boy, was <a href="http://jade.mcli.dist.maricopa.edu/alan/">Alan</a> right&#8230; Don&#8217;t use the version of MySQL (4.0.16) that comes prepackaged in MacOSX 10.3 Server. Man, does it stink.</p>
<p>Update to 4.0.17, using the handy dandy installer provided on MySQL.com/downloads   &#8211; it works great, and even starts on boot (unlike the version that comes with panther&#8230;)  Just bit the bullet and updated versions on careo.ucalgary.ca, and the weird database behaviour has apparently disappeared.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.darcynorman.net/2004/01/09/mysql-on-macosx-10-3-panther-server/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
