A few days back, Geekflare was unavailable, and the reason was simple – no space left on the device. Had hundreds of alerts and emails from the audience about the website being down but I was traveling so couldn’t take action on time. This was logged in Google Cloud logs. This was a surprise to me as Geekflare is just a simple blog and doesn’t store or process huge data. So, I started investigating and found /var/log/mysql was taking ~50% of total storage. And, after listing the files. It was binary logs. You may think of deleting them to recover the system but keep in mind it will fill up again. So, the best way to prevent this is to instruct MariaDB not to log. I don’t have replica implementation so it is ok to disable the binary logging. It is a simple one-line configuration.

If using MariaDB

Login to the server where MariaDB is running Go to /etc/mysql/conf.d Take a backup of mariadb.cnf Add the following under [mysqld] directive

Save the configuration file

At this time, you may delete those binary log files and restart the database.

If using MySQL

Login to the MySQL server Go to /etc/my.cnf.d/ Add the following in mysql-server.cnf file in [mysqld] directive

Save the file and restart the MySQL server

Now, you can delete those binaries files under /var/lib/mysql. Hope this helps. If you are running a critical application then you may also want to consider going for managed MySQL hosting who take care of performance optimization.

How to Disable Binary Logging in MariaDB and MySQL  - 1How to Disable Binary Logging in MariaDB and MySQL  - 29How to Disable Binary Logging in MariaDB and MySQL  - 69How to Disable Binary Logging in MariaDB and MySQL  - 70How to Disable Binary Logging in MariaDB and MySQL  - 13How to Disable Binary Logging in MariaDB and MySQL  - 77