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:



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

1 Answer 1


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:

  • I want to disable logrotate. will it effect my other applications Logs? Feb 13, 2014 at 13:28
  • I'm not suggesting that you disable logrotate... just pointing you in the direction of what I suspect is rotating your binlogs unexpectedly. You should be able to simply comment-out everything in the mysql-server file to stop the behavior... but there's not really a disadvantage to letting it rotate your binlogs every day. Storing the same events in one log vs multiple logs will only result in a very tiny increase in storage space required, since the binlog format is generally very efficient. Feb 13, 2014 at 14:21
  • As I am going to make an Automatic Backup script. So I need to FLUSH logs when backup script will run. What is the method to stop log rotate? (As I know to remove it from cron.daily but is there any other way?) Feb 14, 2014 at 4:19
  • My backup script uses "mysqldump --flush-logs", so I commented out the line with "$MYADMIN flush-logs" in file /etc/logrotate.d/mysql-server. Now I get a fresh log file when I backup or restart mysql
    – ropo
    Feb 22, 2017 at 9:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.