MySQL Binlog – Why Is a New Log File Created Daily?

backupbinlogMySQL

I have started binary logging on MySQL server on my Ubuntu. It start creating log files in /var/log/mysql. My my.cnf configuration is as follows:

log-bin="/var/log/mysql/"
expire_logs_days=10 
max_binlog_size=50M 
binlog-ignore-db="phpmyadmin"

Problem:

When I check logs folder a new file appears daily. Which is created at around 6:45AM to 7:00AM IST i.e 1:30AM to 1:45 GMT. But According to official documentation of MySQL on Binary Logging says:

The server creates a new file in the series each time it starts or
flushes the logs. The server also creates a new binary log file
automatically after the current log's size reaches max_binlog_size.

Why new log file is created daily as:

  1. My system is not rebooted from last 10days which I checked with uptime command in terminal.
  2. The max_binlog_size is given 50M in configuration and my logs reached only 2-3M.
  3. I have not used FLUSH logs.
  4. I have no CRON which do some task auto magically.

I have googled this query but didn't find the reason.

Can anyone help me to know the reason. Thanks in advance

Best Answer

4. I have no CRON which do some task auto magically

I'll speculate that you actually do. Linux systems often use the logrotate utility to manage rotation of log files from numerous disparate subsystems.

Distro builders love to coerce software installed from packages to Do Things The One True Way™ so it should not surprise you if they have "extended" MySQL server beyond the official documentation, to rotate its own binlog.

You may find syslog entries mentioning "logrotate" around the time that the binlog changes, and further explanation is likely to be found in a file somewhere around here:

/etc/logrotate.d/mysql-server