Lesson learned: Back up, back up, and back up.

September 20, 2020 0 Comments

If you’ve popped in on my site in August & September, you’ve seen it change. Lost some content. For a long time, since 2007 actually, I have hosted my websites myself on my own MacMini machines. Has worked beautifully, but I found out complacency is the enemy. I have two servers currently: one handles e-mail, one handles my websites and other capabilities. (Pictured above. IP addresses obscured to protect the innocent). As luck would have it, when I went away for a long trip, disaster struck! My mail server went down. No mail received. Perplexing issue, compounded by the fact that I’m trying to work on my server remotely. BTW, I highly recommend Remotix for iPad, if that’s what you have with you. Long story short, days of troubleshooting led to some UpNp ports mysteriously opened on my router that conflicted with the mail ports. Suspicious of a hack attack. So, mail problem solved. And I closed the UpNp auto configure in my router–and recommend you do too if you run any servers, etc.

But because I was trying to restore things, I attempted to use the web server as my mail backup. I use MySQL and WordPress for my site content. For whatever reason, a reboot of the Mac rendered my MySQL database useless, meaning no web sites! For DAYS I tried different things, all while using my iPad as a remote to the server. No luck. I finally resorted to an old backup on the mail server to get me by until I got home, and could do a full Time Machine backup. This old database version was months old. Meaning lots of updated content was not there!

Take my advice: DON’T rely on Time Machine to properly backup your database. Save the headaches!

I hoped, and expected, that a full Time Machine Restore would work. I could only do this with a keyboard/monitor connected locally, so couldn’t wait until I returned home………Well, THAT didn’t work. MySQL still won’t launch. Restore a clean iOS (Mojave, then Catalina, then BACK to the orginial Mojave). STILL no luck. MySQL must be rooted pretty deep in the OS where Time Machine doesn’t venture. More spending hours & hours struggling with this. I finally stumbled on the solution–it’s how you learn after all. In my case, I found a database entry was not working.

There it is. The little bugger causing all of my problems. Needed to delete it.

If you’re reading this because you have this issue yourself: look at your .err file in the data directory. Remove the database that it might say has a “multiple.” It was for “Comments” which I wasn’t really too concerned with. Took it out of the database—it starts! Yay! Almost……..for whatever reason my most recent Time Machine only has the database from a few months ago. I lost 3 posts and a few pages. Despite that frustration, I’m just thrilled—–after ALL of this time—-to have things “mostly back.” And I will NEVER let this happen again. Take my advice if you run similar: Back up your WP, back up your MySQL on a regular basis. Please save yourself from the “server hell” I experienced. I found a great WP plug-in that makes this easy: WP DB Manager. Get it……use it. Now for more geeky instructions (and I say that affectionately). If you stumbled upon this, you are probably also in “server hell.” I hope this helps you.

On Mac OS (Mojave): Inside the mysql folder.

A database missing some data is still better than NO database running.

I am using Mac OS (Mojave), so my instructions are based from that. Go to your MySQL folder: (usr/local/mysql). The data directory will be restricted. Right click–Get Info. Unlock the lock with your password, then make “Everyone: Read/Write.” Now you can see the contents. You want the .err file. My quick way of viewing it was through terminal using Pico: sudo pico (drag file to terminal for rest of file path). You may see a database file showing issues. In my case, I had a “duplicate ID number.” Your WP database will also be locked, so use above method to access it as you did with the “data” folder. Move suspected files, one at a time, out of the folder. Restart MySQL through preference pane (it may already start running). Hopefully after moving just one of the files, it will start. Awesome! MySQL is back up! Hopefully without much data loss, but as I did it, I counted my blessings that it was running. A database missing some data is still better than NO database running. When things are working again, be sure to return those permissions in the “Get Info” windows back to “Everyone: No Access” to lock the folders properly. Hope you found some good luck in this. If you did, drop me a line through the bottom of the page.

A happy sign: as with most everything else, “steady green lights are good”