skip to Main Content

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


  1. MySql clearly states this in their documentation. The random number you mention is actually the index

    It mentions examples like

    PURGE BINARY LOGS {
        TO 'log_name'
      | BEFORE datetime_expr
    }
    

    And

    PURGE BINARY LOGS TO 'mysql-bin.010';
    PURGE BINARY LOGS BEFORE '2019-04-02 22:46:26';
    

    You need to figure out what is the best fitting for you. You can refer to that document about your query

    Login or Signup to reply.
  2. 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 variable binlog_expire_logs_seconds (default 30 days). The automatic purge of binary logs happens at server start or when you do a FLUSH 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.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search