MySQL binlog files are taking up all disk space
I am running Flywheel’s Local app on a MacBook Pro and noticed that I was constantly running out space on my MacBook’s SSD. Even after I cleared big chunks of space it would quickly fill up and run out of space.
The problem was MySQL and its binary log files (located at /Users/<username>/Library/ApplicationSupport/Local/run/<random-hash>/mysql/data) – the new binlog files kept on appearing and eventually would fill up all the available space on the SSD.
Add the following line to the [mysqld] section of the MySQL server configuration file template (my.conf.hbs). It is located in the /app/cnf/ directory of your Local’s site.
expire_logs_days = 3
The following will tell the MySQL server to only keep the binary log files for up to 3 days and delete the older ones.
Alternatively, you can add the following (which will completely disable the logging)
Restart the MySQL server and you will see that the old bin files will shortly disappear.
Note: do not delete the bin files manually – let the MySQL server handle it by using the expire_logs_days configuration.