I recently upgraded to MySQL 8.4, and I just noticed my C drive is almost full. After looking into it, I realized that MySQL has been creating a bunch of files called "binlog.XXXXXX" where XXXXXX is a random number (it appears). The files are stored in C:/PrograData/MySQL/MySQL Server 8.4/Data.
Are these just log files that can be deleted, or are they constantly used/referenced by the database.
If they can be deleted, is there a way to have MySQL automatically delete old binlog files. Ideally I can designate how "old".
2
Answers
MySql clearly states this in their documentation. The random number you mention is actually the index
It mentions examples like
And
You need to figure out what is the best fitting for you. You can refer to that document about your query
Binary logs are needed for replication; if you are not using replication, you can delete these at will manually with
PURGE BINARY LOGS ...
.Or automatically remove binary logs by setting the server variable
binlog_expire_logs_auto_purge
to ON (the default) and adjusting the server variablebinlog_expire_logs_seconds
(default 30 days). The automatic purge of binary logs happens at server start or when you do aFLUSH BINARY LOGS
or flush-logs via the mysqladmin command; if your server is on continually, do the flush logs via cron or a windows Scheduled Task.