MAN Down! MAN Down!

Well the computer blew up. I restarted it and it wouldn’t boot up again. Couldn’t mount the harddrive via target disk mode… nothing. This led me to believe it was the harddrive.

So while I took the beastie in to get serviced (seems that the G5 iMacs with iSight are virtually impossible to open without the proper tools I figured better safe than sorry) I decided to see if I could rescue my blog. Google caches accounted for most of the posts up till May 09 and luckily I had backed up everything to the new mac mini in March. That meant potentially I was only out of action for the month of April which wasn’t bad all in all.

Here begins the trials…
Firstly the mac mini is an intel chip and I couldn’t find an install for the same version of mysql as was on the iMac. And it turns out it is virtually impossible to restore the database files across version. The preferred way is to do a database dump from the source database and a restore on the new one:
admin$ mysqldump [databasename] > [Newdatabasename.sql]
then
admin$ mysql -u[user] -p [databasename] < [Newdatabasename.sql]
This basically left me screwed until I got a call to tell me it was my logic board and not the drive that had failed. 2nd time for a logic board on that piece of hardware you may recall. One of my few Mac lemons...

So I swung by the shop, picked up the drive and a new sata case, had the poor old G5 recycled. I successfully booted the mini from the old drive and did the dump. So now comes the easy part. I tried a new install on the mini of everything (php, mysql, wordpress) but it wasn't as easy as I remembered.

I downloaded...
mysql from here:
dev.mysql.com/downloads/mysql/5.1.html
php from Marc Liyanage's site: www.entropy.ch/software/macosx/php/
and a new clean install of wordpress: codex.wordpress.org/Installing_WordPress

The problem was all my notes about granting privileges and making databases and whatnot are on this stupid blog (inaccessible at that point you see) and thus the install took longer than expected.

I had trouble starting mysql until I tried this:
sudo /usr/local/mysql/bin/mysqld_safe --user=mysql

So then …
Login to mysql after the install: mysql -uroot (no password)
Then:
mysql> CREATE DATABASE databasename;
Query OK, 1 row affected (0.00 sec)
mysql> GRANT ALL PRIVILEGES ON databasename.* TO "wordpressusername"@"hostname"
-> IDENTIFIED BY "password";
Query OK, 0 rows affected (0.00 sec)
mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.01 sec)
mysql> EXIT

After that you should set the root password for mysql
mysql> SET PASSWORD FOR 'root'@'localhost' = PASSWORD('password');

After restoring my files and themes I was up and running again. Now I guess its time to clean up the theme a little…