Mysql binary log query

I am reading MySQL binary log, my mysql-bin.index contains :

/var/log/mysql/mysql-bin.000177
/var/log/mysql/mysql-bin.000178
/var/log/mysql/mysql-bin.000179
/var/log/mysql/mysql-bin.000180
/var/log/mysql/mysql-bin.000181
/var/log/mysql/mysql-bin.000182
/var/log/mysql/mysql-bin.000183
/var/log/mysql/mysql-bin.000184
/var/log/mysql/mysql-bin.000185
/var/log/mysql/mysql-bin.000186
/var/log/mysql/mysql-bin.000187
/var/log/mysql/mysql-bin.000188
/var/log/mysql/mysql-bin.000189
/var/log/mysql/mysql-bin.000190
/var/log/mysql/mysql-bin.000191
/var/log/mysql/mysql-bin.000192
/var/log/mysql/mysql-bin.000193
/var/log/mysql/mysql-bin.000194
/var/log/mysql/mysql-bin.000195
/var/log/mysql/mysql-bin.000196
/var/log/mysql/mysql-bin.000197
/var/log/mysql/mysql-bin.000198
/var/log/mysql/mysql-bin.000199
/var/log/mysql/mysql-bin.000200
/var/log/mysql/mysql-bin.000201
/var/log/mysql/mysql-bin.000202
/var/log/mysql/mysql-bin.000203
/var/log/mysql/mysql-bin.000204
/var/log/mysql/mysql-bin.000205
/var/log/mysql/mysql-bin.000206
/var/log/mysql/mysql-bin.000207
/var/log/mysql/mysql-bin.000208
/var/log/mysql/mysql-bin.000209
/var/log/mysql/mysql-bin.000210
/var/log/mysql/mysql-bin.000211
/var/log/mysql/mysql-bin.000212
/var/log/mysql/mysql-bin.000213
/var/log/mysql/mysql-bin.000214
/var/log/mysql/mysql-bin.000215

Before few days the file had names with index starting from mysql-bin.000163, I was not abel to find any information online when does MySQL rotates binary log files, I want to get first data modification query on the database.

Is there a way to do that using binary logs ?

Hi,

You should check the size of max_binlog_size, default value is 1GB. So whenever your current binlog file’s size reaches to max_binlog_size, it will automatically rotate to new binlog file. Check more details here,

[URL]http://dev.mysql.com/doc/refman/5.0/en/binary-log.html[/URL]
[URL]MySQL :: MySQL 8.0 Reference Manual :: 17.1.6.4 Binary Logging Options and Variables

You should check at the location of binlog file if its exist or not. In your case, it is [COLOR=#252C2F]/var/log/mysql/
If it exist then only you can check the content of that file by using mysqlbinlog. i.e

shell> mysqlbinlog /var/log/mysql/mysql-bin.000163

You can also check the value of expire_logs_days, if you crosses that value then your binlog will be automatically purged.