Today I met with The Revd Canon Cliff Piper, a friend from my days in The United Diocese of Moray, Ross and Caithness, and the convenor of the Information and Communication Board of the SEC to teach him how to use and update the SEC website. It was great to catch up with Cliff, and I gave him a full behind-the-scenes low-down on how the website works and how to add and edit posts, upload images and all that jazz. But the day didn’t exactly begin quite so well.
I decided that it would be better if we worked on a mirror copy of the website on another server, rather than on the actual SEC website. That way if things went wrong it wouldn’t matter. So I backed up the database, backed up the files, and then uploaded WordPress to another server and created a new database. That all went well, no problems there.
I then restored the backed-up SEC website database to the new mirror server. And somewhere in the process of updating the options on the mirror site my poor browser got confused and updated the actual site. (Are you following me so far?) The result was that the actual SEC website now thought it was on the mirror server!
We’re talking serious problems here. We’re talking a website with a bit of a mental illness: all the physical files were in place and looked fine, but somehow the website’s ‘mind’ (the database) was all messed up!
That shouldn’t be a problem! I should just be able to restore the backed-up database. Except that Lumison, the web host that the SEC website is stored on, doesn’t use a user-friendly MySQL database management tool like phpMyAdmin. Instead they prefer you to use SSH Shell access, in other words you text type commands into a black screen to connect to a remote computer.
Thankfully, in my Geek Kitâ„¢ I have a copy of PuTTY, a client program for the SSH, Telnet and Rlogin network protocols. Here is a screenshot of it, in all its glory:
Exciting stuff! And oh so simple to use!? It took me a couple of goes, but I eventually managed to login to the Lumison shell server (
shell.lumison.net) and then login to their MySQL server and restore the backup database file, writing over the dodgy info with good, clean, newly-backed-up data, using this memorable command-line:
mysql -h mysqlhostserver -u mysqlusername -p databasename < public_html/backup/sec.sql
(The names of real passwords, usernames and locations have been changed to protect the innocent.) Always handy to know how to do these things.
Now that the real website was working fine, returning to my mirror site I logged into the MySQL database using phpMyAdmin — which my fine server host offers — and I manually edited the database, ready for Cliff and I to play around with it. And I made sure that the real SEC website was open in Firefox and the mirrored site in Opera. I sure didn’t want to get my poor browsers confused again.
It was a good idea, a shame that I broke it!