WordPress Error: MySQL server has gone away

I had no idea what to do, so I Googled it

Found this link below and tried the repair thing as the settings were in the config file as expected:
https://dba.stackexchange.com/questions/269450/warning-mysqli-real-connect-hy000-2002-connection-refused-in-var-www-htm

But then suddenly, my config file contents became my homepage contents! Including my database name, username, and password. I had to get rid of that fast!

I found there was a file wp-config.php and a wp-config-old.php. The old one looked way cleaner and nicer, so I figured since my site was pretty messed up already, I swapped them, and the site was totally fine again.

If there hadn’t been an old config file that I could switch to, I would’ve renamed the wp-config anyway to prevent it from displaying on my public homepage — and then worked to figure out another solution.

This reminded me to back up my WordPress regularly. There is an import and export function.

This way, you will have an XML file for the future in case your WordPress blows up. I went ahead and created a totally free WordPress site to restore it and make sure it works. You can do that here — https://www.infinityfree.com/

Leave a Reply

Your email address will not be published. Required fields are marked *

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