mysql binlog taking too much of space

Recently i have installed mysql 8.0.22 on ubuntu 20 and with in 30days, i see that server is using 90GB of space and i know for sure, we didn’t upload that much of data into server at all.

so i have checked for logs and storage usage.

when i do du -hs /* i see that, /var/lib/mysql is using 47GB and when i cd into that folder, i see bunch of binlog.000xxx files

and removing them directly is not a good idea ofcourse so i decided to reduce their expire time so that mysql will delete them automatically.

most of online articles suggesting me to edit its value in my.cnf but i guess that path is changes and when i edit my.cnf , mysql is not restarting too.

upon finding, i see that…its setting name is changed and location has been changed.

to change its expiretime, open nano /etc/mysql/mysql.conf.d/mysqld.cnf and you can find

#binlog_expire_logs_seconds = 2592000

uncomment the line and change its value as you wish.

mysql should clean up binlogs after that!

One thought on “mysql binlog taking too much of space

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.