SQL Woes

For the most part, managing my web server is pretty straightforward, especially because I don’t really get a ton of traffic. Its mostly just keeping things up to date through standard channels.

Occasionally I have a bit of a brain fart moment. I recently was doing regular Linux updates on the server. I noticed a message I had seen before about some packages being held back. Occasionally I will go through and update these, because I am not real sure why they are being held back, but don’t really see any reason they should be.

Then MySQL broke.

So I went digging in some logs and searching for solutions, and decided I needed to roll back the version. Following a guide I found, I discovered… I had done this before, which I now vaguely remebered. Because the old .deb file was still there from last time I broke it.

Anyway, this didn’t fix it, MySQL still was not launching.

I decided that maybe it was time to just switch to MariaDB, which I believe is the spiritual successor to MySQL. And the process was simple enough, I would not even need to dump my Databases. So I uninstalled MySQL, installed MariaDB and… It worked!

Then it stopped working.

I restarted the SQL service and it worked!

Then it…. Stopped working… Again…

So I checked logs again and corrected some issues there and again it worked, then a half hour or so later it stopped working.

One thing I had come across in troubleshooting the original MySQL issue was that there was a command, mysql_upgrade that needed to be run to change how some tables are configured. I couldn’t do that before because I couldn’t even get MySQL to run. But I could get MariaDB to run at least for a bit, and had successfully gotten this upgrade command to run.

So I decided to, once again, try MySQL again, so I uninstalled MariaDB, and purged everything out, rebooting a few times to be sure. And MySQL would not even install anymore, so more purging, this time, including the Databases.

One thing I was glad I had decided to do, “Just in Case” when MariaDB was “working” was dump the databases out with backups. I was glad I did at this point. So with absolutely everything purged, MySQL installed and was working.

I set about recreating the databases from the dumps, and while I was at it updated all the passwords, since I had to recreate the user accounts used by WordPress anyway.

And now everything is working smoothly again.

A couple of links that were actually helpful in solving my problem.

https://stackoverflow.com/questions/67564215/problems-installing-mysql-on-ubuntu-20-04

https://learnubuntu.com/install-mysql/

Code Project: Automated List From Reddit Comments

This is one of those quick and kind of dirty projects I’ve been meaning to do for a while. Basically, I wanted a script that would scrape all of the top level comments from a Reddit post and push them out to a list. Most commonly, to use on /r/AskReddit style threads like, well, for this example, “What is a song from the 90s that young people should listen to.”

Basically, threads that ask for useful opinions on list. Sometimes it’s lists of websites or something. Often it’s music. The script here is made for music but could be adjusted for any thread. Here is the script, I’ll touch on it a bit in more detail after.

## Create an APP for Secrets here:
## https://www.reddit.com/prefs/apps

import praw

## Thread to scrape goes here, replace the one below
url = "https://www.reddit.com/r/Music/comments/10c4ki0/name_one_90s_song_kids_born_after_2000_should_add/"

## Fill in API Information here
reddit = praw.Reddit(
    client_id="",
    client_secret= "",
    user_agent= "script by u/", # Your Username, not really required though
    redirect_uri= "http://localhost:8080",
)


submission = reddit.submission(url=url)
submission.comments.replace_more(limit=0)
submission.comment_limit = 1

for x in submission.comments:
    with open("output.txt", mode="a", encoding="UTF-8") as file:
        if "-" in x.body:
            file.write(str(x.body)+"\n")
            # print(x.body)

The script uses praw, Python Reddit API Wrapper. A Library made for use in Python and the Reddit API. It requires free keys which can be gotten here: https://www.reddit.com/prefs/apps. Just create an app, the Client ID is a jumble of letters under the name, the secret is labeled. User Agent can be whatever really, but it’s meant to be informative.

The thread URL also needs filled in.

The script then pulls the thread data and pulls the top level comments.

I’m interested in text file lists mostly, though for the sake of music based lists, if I used Spotify, I might combine it with the Spotify Playlist maker from my 100 Days of Python course. Like I said before though, this script is made for pulling music suggestions, with this but of code:

        if "-" in x.body:
            file.write(str(x.body)+"\n")
            # print(x.body)

It’s simple, but if the comment contains a dash, as in “Taylor Swift – Shake it Off” or “ACDC – Back in Black”, it writes it to the file. Otherwise it discards it. There is a chance it means discarding some submissions, but this isn’t precision work so I’m OK with that to filter out the chaff. If I were looking for URLs or something, I might look for “http” in the comment. I could also eliminate the “if” statement and just have it write all the comments to a file.

Sunday 2023-01-15 – Link List

Blogging Intensifies Link List for Sunday 2023-01-15

22-Jun-2020 – How to search Google without using Google, the self-hosted way

Brief Summary: “Hello everyone!
Last week I was talking with a friend and he was complaining about how Google knows everything about us,
so I took the chance to recom”

13-Jan-2023 – Deep Rock Galactic sold 2.3 million copies last year and I’m not surprised – it’s awesome

Brief Summary: “Deep Rock Galactic is a game about a bunch of Dwarves going mining, and there’s lots of creepy-crawlies that want to get in the way. It seems to only “

13-Jan-2023 – TNT Won’t Air Final Season of SNOWPIERCER

Brief Summary: ”
The small screen bloodbath continues. Deadline reports that Season 4 of Snowpiercer, the final outing of TNT’s last scripted series, won’t air on the”

13-Jan-2023 – Final Fantasy 7 mod adds voice acting to original game

Brief Summary: ”
The original Final Fantasy 7 is now fully voice acted, thanks to a new mod by the Tsunamods community.

Available today, Echo-S 7 adds voice acting t”

14-Jan-2023 – Is Hasbro Slowly Choking The Collecting Communities?

Brief Summary: “Today I want to talk about Hasbro’s current business strategy. This is not about whether or not Hasbro will go down, they will not, but ever since Chr”

Thursday 2023-01-12 – Link List

Blogging Intensifies Link List for Thursday 2023-01-12

12-Jan-2023 – HBO Max Increases Monthly Subscriber Price from US$14.99 to US$15.99

Brief Summary: “New ad-free plan pricing starts on February 11”

12-Jan-2023 – [Epic Games] Divine Knockout (DKO), First Class Trouble, Gamedec (Free/100% off)

Brief Summary: “submitted by /u/AT1952 [link] [comments]”

11-Jan-2023 – [Humble Bundle] Wadjet Eye: Sixteen Years of Adventure! (pay at least €9.48 for Unavowed, Strangeland, Primordia, Shardlight, Technobabylon, Resonance and more)

Brief Summary: ” submitted by /u/lovecrafthp [link] [comments] “

12-Jan-2023 – GOG officially ends its Steam-import Connect service after years of inactivity

Brief Summary: ”
GOG’s Connect service, which let users grab a free copy of a game they already owned on Steam to add their GOG library, is officially no more.

Launc”

12-Jan-2023 – Legend of Zelda cartoon writers reveal D&D influences

Brief Summary: ”
I may be biased, but I really feel that 1989 was a great year (I am biased because it was the year I was born). But, aside from my arrival in the wor”

11-Jan-2023 – Last year was a disaster for PC games – here’s how things need to change

Brief Summary: ”
2022 was a rough year for PC ports. Between stuttering performance issues and infuriating user experience problems, I was almost broken as a reviewer”

11-Jan-2023 – NES The Legend of Zelda recreated in VR Doom mod

Brief Summary: ”
If you’ve ever wanted to fully immerse yourself in The Legend of Zelda now’s your chance as a modder has made the original NES game playable in VR.

11-Jan-2023 – ClassicPress Community Votes to Re-Fork WordPress

Brief Summary: “In December 2022, the ClassicPress community voted on whether to re-fork WordPress or continue on with the project as-is. As WordPress continues to ev”

12-Jan-2023 – Humble’s excellent Wadjet Eye bundle has 13 games for less than a tenner

Brief Summary: “Wadjet Eye Games are behind some of the greatest point and click adventures of the last two decades, and if you’ve been looking for an excuse to catch”

12-Jan-2023 – The Legend of Zelda: How Every Version of  Zelda Is Related

Brief Summary: “Despite its name, the Legend of Zelda series has historically focused on Link. Even though they share the same name, most Links in the franchise are a”

12-Jan-2023 – Mega Man-like side-scroller action game Super Alloy Ranger now on Linux

Brief Summary: “Enjoy games similar to Mega Man? Like running and gunning? Super Alloy Ranger looks interesting and they recently put up a Native Linux version too.”