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  - 98How to Disable Binary Logging in MariaDB and MySQL  - 10How to Disable Binary Logging in MariaDB and MySQL  - 32How to Disable Binary Logging in MariaDB and MySQL  - 69How to Disable Binary Logging in MariaDB and MySQL  - 50How to Disable Binary Logging in MariaDB and MySQL  - 72How to Disable Binary Logging in MariaDB and MySQL  - 92How to Disable Binary Logging in MariaDB and MySQL  - 49How to Disable Binary Logging in MariaDB and MySQL  - 74How to Disable Binary Logging in MariaDB and MySQL  - 79How to Disable Binary Logging in MariaDB and MySQL  - 14How to Disable Binary Logging in MariaDB and MySQL  - 44How to Disable Binary Logging in MariaDB and MySQL  - 52How to Disable Binary Logging in MariaDB and MySQL  - 43How to Disable Binary Logging in MariaDB and MySQL  - 57How to Disable Binary Logging in MariaDB and MySQL  - 71How to Disable Binary Logging in MariaDB and MySQL  - 81How to Disable Binary Logging in MariaDB and MySQL  - 7How to Disable Binary Logging in MariaDB and MySQL  - 38How to Disable Binary Logging in MariaDB and MySQL  - 8How to Disable Binary Logging in MariaDB and MySQL  - 43How to Disable Binary Logging in MariaDB and MySQL  - 31How to Disable Binary Logging in MariaDB and MySQL  - 85