WordPress 5.9 is out! Very exciting stuff. I am really excited to try out full-site editing. I think that full-site editing will really be the moment where all of the previous work on Gutenberg starts to make sense. Editing the design of your site is just as easy as editing the content. It is also really remarkable how WordPress has been able to undergo this huge transition while maintaining backwards compatibility. I have not gotten around to converting my various plugins to Gutenberg yet, and they still work. I will probably have to convert them someday, but not yet.
So, today I went about upgrading to 5.9. The WP-admin upgrade page warns to backup your files and database. I almost clicked the update button without doing that, but I decided to be safe. For years now I have been using a very simple site backup method for this. I ssh
into my host (which is hosted on dreamhost.com) and then simply run a tar command and a mysqldump command like so (note that I pipe the output to gzip
, and tell gzip
to read from stdin by simply specifying -
, which is shorthand for stdin in many UNIX commands, and then I redirect the output to a file using >
)
tar -czf robfelty.com.20220203.tar.gz robfelty.com
mysqldump -u $USER -p -h $HOST robfelty | gzip - > robfelty.20220203.sql.gz
Enter password:
mysqldump: Error: 'Access denied; you need (at least one of) the PROCESS privilege(s) for this operation' when trying to dump tablespaces
Wait, what happened? This used to work! It appears that dreamhost has taken away the ability to do mysql dumps like this. I did a bit of searching around for answers, but didn’t find anything, so decided to try PHPMyAdmin instead. I was able to download the database backup that way to my laptop, and then rsync
it to my server.
I’m glad I backed up, because this time around, the upgrade failed! In 15 years of running WordPress, I think this has only happened two or three times for me, but I am glad that I backed up. I think what happened is that the download to the server probably timed out or something, which left it in a partially updated state. I knew the drill to restore the database – like so
mv robfelty.com robfelty.com.broken
tar -xzf robfelty.com.20220203.tar.gz
# normally I would store the database backup gzipped, but my PHPMyAdmin
# download was not compressed, so I just left it that way
mysql -u brezn -p -h mysql.blog.fedibblety.com robfelty < robfelty.sql
Unfortunately the last command failed too, complaining that wp_commentmeta
already existed. Apparently the PHPMyAdmin dump did not include DROP
table statements, like the default with mysqldump
. So I added those in manually with a little sed
sed -i 's/CREATE TABLE `\([^`]\+\)`/DROP TABLE IF EXISTS `\1`; CREATE TABLE `\1`/' robfelty.sql | grep 'CREATE TABLE'
Then I could run the mysql command to restore the database back to the good version. I logged into wp-admin and everything looked okay. I decided to simply click the upgrade button once more, hoping that my guess about a time-out was correct. The second time it worked without any issues. I am happily writing with WordPress 5.9. Soon I will try out the new 2022 theme with full-site-editing support. I am thinking about being brave and just modifying in place, without doing any sort of staging site.