Dump A MySQL Database To YAML Using PHP

The Problem

I was recently working on a project that is built on WordPress / BuddyPress. I built up some content using the CMS features of WordPress in my development server and then I transfered the WordPress content to a beta server using the export/import functionality. That kind of stinks having to do that every time I want to push updates to my beta server. So I looked into using Doctrine to generate data fixtures which I could repeatedly run against the different database. Doctrine supports YAML files, which are extremely easy to edit by hand, so it seemed like a good idea.

So what’s the problem? Well, I didn’t currently have any of my data in YAML files. I didn’t want to had edit them or do some sort of copy and paste madness. So, I wrote a script in PHP to dump my data into a YAML file.

Read more

Upgrade Time : WordPress 2.9 and MySQL 5

WordPress 2.9 was release somewhat recently and so like a good WP minion I logged into my site and clicked the update button. Error… uh oh. Apparently WordPress 2.9 requires a more recent version of MySQL (>= 4.1.2). My host installed MySQL 5 ages ago but I’ve never bothered with migrating to the new version because I didn’t have a reason to. Now I do. So here’s how my upgrade went.

First I made a full backup of both the web content and the MySQL database. The MySQL database backup was just a mysqldump command like so:

Read more