When log-bin is enabled, MySQL will log completed SQL transactions into binary logs.
Binary Logs are maintained by a text file whose name would be the same as the binary log but have file extension of
For example, say you had
log-bin=/mysqllogs/mysql-bin and started mysqld.
There will be files placed in
The index file will contain the name of all the binary logs.
In this example, it would contain
Over time, binary logs will accumulate and you will have something like this in
mysql-bin.index will contain this
Based on the variables expire_logs_days (if it is greater than 0) and max_binlog_size, mysqld will do its own rotation and expiring of binary logs.
If you do the following
rm -f mysql-bin.000001
rm -f mysql-bin.000002
this will disable mysqld's log rotation mechanism. Why ?
/mysqllogs folder will have
mysql-bin.index will still contain this
mysqld actively uses the index file to verify that every file in
/mysqlvar listed in
mysql-bin.index exists before doing any rotation or expiration.
Therefore, you should never let the OS delete binary logs. Let mysqld do it.
I wrote about this before
Shutdown mysqld, edit your
.index file so the contents matches the exist binary logs on disk, and start mysqld. I have suggested this before (Mysql binlogs exists, show binary logs is empty)
GIVE IT A TRY !!!