Adventures with SQL

I’m not much of a SQL expert…I’ve used SQL to run database queries a few times in my life, so I’m familiar with the process, but my knowledge of SQL could fill a thimble.

Every time I want to run a query, I have to look up the SQL reference to remember the proper formatting, keywords and syntax.

So, where am I going with this?

In an effort to clean up my blog a bit, I’ve been running various scans and evaluations on my content. The issue arose from the fact that I host all my images and videos locally, I don’t trust any of the big tech companies not to blackball me at some point, so I don’t use them. I’ve been doing that pretty much since I moved over from blogger many years ago.

The problem is that any of my old posts where I embedded an image or video from my own site, were referenced to the http: version rather than the https: version. That’s what was causing the warnings.

Well, I knew it would take freaking forever to go back and update 13 years worth of old posts, so I decided to do it the dangerous way. I logged directly into the WP database and ran a SQL query that replaced every instance of “” to “”.

I’m posting about it because I’m proud of myself for figuring it out, doing it correctly and not blowing my blog completely up. Of course, I backed up the database before I did it so I could restore if disaster struck, but I got it right the very first time and it worked perfectly. No more warnings about references to unsecure content.

It took me about 5 minutes to back up the database, about 10 minutes to remind myself of the SQL terms and syntax for the query I wanted to run and about 2 seconds for the query to actually execute.

Versus who knows how many hours it would have taken to fix it all manually.

Sometimes a little geek knowledge comes in handy.

Oh, and I fixed a couple of other minor little niggling things that had been bothering me too. If I get nothing else done all day (fat chance of that), I’ll feel a sense of accomplishment just for what I’ve done here.


1 thought on “Adventures with SQL

  1. Congrats on not deleting the blog 🙂 Having backups (or in other situations source control management like cvn or git) sure can make it less stressful when you’re experimenting.

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.