I Broke My Server Again Take Two


Ironically, after I purposely broke my theme a lot, I also broke my whole server. My website was down and not responding so I SSH’ed into it. I then checked that Nginx was running, it was, but I restarted it anyway because why not?

It Worked?

No, of course, it didn’t work, but it made the shit load so it said database connection error. So I tried to restart MySQL. It gave me an error and I had to type journalctl or some shit to find out more information. Out of disk space! I then type df -h, and sure as fuck I was. All gone…which is odd because I have more than what I should need for 1 site.

Using a bunch of du commands I was able to determine it was coming from lib/mysql/. I don’t have permission to change the directory into it but I can ls the shit. A bunch of binary files. Apparently, MySQL keeps binary logs of every database transaction or something and you can’t just delete them because they have an index file.

So you use MYSQL, you go in and you purge those fuckers. There are two ways I know, and I have a favorite

 mysql> PURGE BINARY LOGS BEFORE 'yyyy-mm-dd hh:mm:ss'; 

So that will delete them before a certain date. It’s useful, but I don’t even know what the files are, so they are useless to me so I prefer doing the above, but instead —

PURGE BINARY LOGS BEFORE NOW();

Cause fuck those files and fuck their existence. Then you will want to do something to stop those fuckers from coming back.

mysql> SET GLOBAL binlog_expire_logs_seconds = (60*60*24);

Now I do not understand the above code, but I think it gives those binary logs a lifespan of a day. I’m sure this will have consequences but they brought the website down and my whole server. Taught me some new shit, but it’s Saturday, I’m not suppose to bel earning.


Leave a Reply

Your email address will not be published.