Migrating My WordPress Database from a Lightsail Instance to a Standalone Database

Last year, I moved this blog off of a EC2 instance running a too-old version of PHP to a Lightsail instance. I had to restart that instance in order to retrieve the images associated with all the prior posts so they looked exactly as they did before, but the end result was the same blog at a lower monthly cost. Since then, I installed and configured the WP Offload Media Lite plug-in to push all those images to an S3 bucket. Today I decided to move the WordPress database off the Lightsail instance to a standalone database.

Accomplishing this move required cobbling together instructions from Bitnami and AWS (and filling in any gaps with educated guesses). Here are the steps I took to get everything moved over, in the order I took them.

  1. Export the application database from the Lightsail instance. As of this writing, the Bitnami WordPress image still keeps database credentials in a bitnami_credentials file, so using that with the mysqldump command generated the file I would need to import to the new database (backup.sql).
  2. Download backup.sql to my local machine. Connecting to my Lightsail instance with sftp and my SSH key followed by “get backup.sql” pulled the file down.
  3. Download MySQL Workbench. Looking at these import instructions, I realized I didn’t have it installed.
  4. Create a Lightsail database. On the advice of co-workers who also do this with their side projects, I used us-east-2 as the region to setup in. I specified the database name to match the one in the backup.sql file to make things easier later when it was time to update wp_config.php.
  5. Enable data import mode. By default, data import mode is disabled and public mode is disabled. So I turned on data import mode and was puzzled for a second when I couldn’t connect to the database in order to import from backup.sql.
  6. Enable public mode. With public mode disabled, and my backup.sql file (and tools to import it) not already available in a us-east-2 hosted instance or other resource, I couldn’t load the backup data. Once I enabled public mode, I was able to use MySQL Workbench to connect and upload the data.
  7. Disable public mode.
  8. Update wp_config.php to use new database credentials.

To confirm that the post you’re reading now was written to the new database, I turned on the general query log functionality on the database instance to ensure that the server was writing to it. Having confirmed that, I turned off the general query log.

The additional cost of a standalone Lightsail database is worth it for the week’s worth of database backups you get with zero additional effort. Migrating to a newer WordPress instance in the future should be easier as well, now that both the database and media for the site are off-instance. The next step I need to take is upgrading from the lite version of WP Offload Media to the full one. This should offload all the media so I can safely remove it locally.

Amazon.com and A9.com switch to Microsoft Search

I hadn’t noticed this until yesterday, but Google is no longer the guts of A9 & Amazon search. According to this article, A9’s contract with Google expired and they decided to go with Microsoft for the replacement.

I tried “v for vendetta” as a search in both A9.com and Google to see how the results differed (if at all). In my case, the top 6 links from A9 were to the V for Vendetta website by Warner Brothers (hits 1-2), its IMDB entry (hits 3-4), its Wikipedia entry, and its Rotten Tomatoes review. Google gave me the same hits, in almost the same order. The only difference was that the top result returned showtimes for the movie close to my zip code. A9 actually provides that info too, you just have to check the “Movies” option.

It looks like Microsoft’s search has actually improved somewhat since I last tried it. I’ll be curious to see what moves Google and Yahoo make to try and stay top two in market share.

Update:

When I talked to my friend Sandro about the switch and told him what search term I used, he suggested I use a tougher search term to test the relevance of lower-level results. We compared the results of searching for his name “Sandro Fouche” between Google and Live.com. With Google, I had to go to the 50th result to find the first irrelevant result. With Live.com, I got an irrelevant result as early as the 10th result.