Mysql 8 Binary Logs ON by default

I'm not sure how typing this in my quiet corner of the internet will be effective in broadcasting the message, but this is a Big Deal for server administrators. Previously binary logging was disabled by default, but now, with the default settings, if you have a busy database server, pretty soon you'll have a hefty chunk of your disk eaten up by binary logs. And if you've ever run out of disk space on a server, you'll know this is not a good thing.

Luckily its pretty easy to fix. Check if its enabled with

mysql -e "show variables like 'log_bin';"

Or, just look in your data directory and see a hoarde of binlog files, of course. You can disable it altogether with


in your mysql ini file (which one you set it in depends on your server version and OS). Or you can just limit the number of seconds it keeps with the following, which will let it keep one day's worth of binlogs, down from the default 2592000 seconds which is 30 days, and, in my opinion a little high for a default value!

binlog_expire_logs_seconds = 86400

If you're not sure whether or not you need binlogs, you probably don't need them. They are used it you're replicating the database to another one, and need to hold enough data so they can sync up in the event of a disconnection. You can also use them to roll the db back or forward to a specific point in time, but that's the province of database ninjas.