Linux – Is it possible to safely edit thesql-bin.index file while thesql server is running

linuxmariadbMySQLmysql-replication

I changed location of mysql bin-log files. I copied them so mysql started fine, because they where in both locations, but then removed them from old location. I forget about correcting the path in index file and now I have problems with purging old binary logs.

So my question is it safe to correct paths in index file while mysql server is running

For example cat correct.index > mysql-bin.index

My server version is mariadb 5.5

Best Answer

This is not a supported procedure as highlighted in official MySQL documentation:

To keep track of which binary log files have been used, mysqld also creates a binary log index file that contains the names of all used binary log files. By default, this has the same basename as the binary log file, with the extension '.index'. You can change the name of the binary log index file with the --log-bin-index[=file_name] option. You should not manually edit this file while mysqld is running; doing so would confuse mysqld.

So no, it's not safe to edit binary log index while mysqld is running.