I am working on a replication setup and have turned on bin-logs. I have moved my mysql datadir to a new location as well as the binlog path
From my.cnf
datadir = /vol/data/mysql
log-bin=/vol/data/mysql/mysql-bin
binlog_format=mixed
When I start mysqld and check the status:
mysql> show master status;
+------------------+----------+--------------+------------------+
| File | Position | Binlog_Do_DB | Binlog_Ignore_DB |
+------------------+----------+--------------+------------------+
| mysql-bin.000315 | 106 | | |
+------------------+----------+--------------+------------------+
When I check the contents of /vol/data/mysql, I can see a lot of bin logs, but specifically, I can see this file was just created:
mysql-bin.000313
mysql-bin.000314
mysql-bin.000315
mysql-bin.index
If I tail the index file:
$ sudo tail mysql-bin.index
/vol/data/mysql/mysql-bin.000313
/vol/data/mysql/mysql-bin.000314
/vol/data/mysql/mysql-bin.000315
In mysql, there are no binary logs at all.
mysql> SHOW BINARY LOGS;
Empty set (0.00 sec)
This means that purging binary logs in mysql has no affect. I checked the permissions of the directory and files and all belong to mysql user and group. Why can't mysql see and/or purge those binary logs?
mysql> PURGE BINARY LOGS BEFORE NOW();
ERROR 1373 (HY000): Target log not found in binlog index
FLUSH LOGS;
does it generatemysql-bin.000316
?SELECT @@LOG_BIN_INDEX;
return? Is that the same path and name as the "mysql-bin.index" file you're examining?@@LOG_BIN_INDEX
global system variable wasn't introduced until MySQL 5.6.4.