New MySQL Utility to Relocate Binary Logs

We are very happy to introduce a new MySQL utility named “mysqlbinlogmove“, which is used to relocate binary log files. This utility is one of two new utilities included in MySQL Utilities release-1.6.0 Alpha. The other utility is “mysqlgrants“, which is used to display the privileges (grants) of database objects.

Note: I use “binary log” to refer to both “kinds” of binary log files (binlog and relay log files) in general, and use “binlog” to refer specifically to those that are not “relay log” files.

The mysqlbinlogmove utility allows you to move binary log files to a new location taking care of correctly updating the respective index file for you. This utility can be very useful if you want to change the location to store the binlog file and you want to move all of the binary log files. It is also handy to archive older binary log files to a new location thereby saving disk space in the server’s partition.

Main Features

Here is a summary of the main features of the mysqlbinlogmove utility:

  • Moves binary log files to a specified source directory, allowing to relocate all files to a new location. For example, with the server stopped before changing the –log-bin option.
  • Moves binary log files using the server connection specified, allowing to easily archive files no longer in use based on the server settings (e.g., log_bin_basename, log_bin_index, relay_log_basename, relay_log_index).
  • Allows you to specify the type of files to move, binlog files (default), relay log files, or both.
  • Provides options to restrict the files to be move based on their sequence number or modified date.


The mysqlbinlogmove utility must be executed on the local server and it requires read and write access to the binary logs and index files, as well as the destination directory to move the files.


Here is an example of the execution of the utility to move all binlog files from a stopped server, simply specifying the source binlog directory and target destination:

Now, let’s look at another example to move all binary log files modified two days ago from a running slave, specifying the server connection instead of the source directory:

In this case, the –log-type option with the value ‘all’ was used to indicate that both binlog and relay log files will be moved, and the –modified-before option to restrict the files by their modified date.

In this example, it is also possible to observe the flush of binary logs. This operation is required in order to refresh the server’s data. The flush operation can be skipped with the –skip-flush-binlogs options.

Do you want to know more ?

Try it now and send us your feedback

MySQL Utilities release-1.6.0 alpha is available for download from the following links.

MySQL developers website:
Launchpad project:

The documentation of MySQL Utilities can be obtained from the following link:

Contributing Ideas:

Meet us at MySQL Central @ Oracle OpenWorld

Do you want to get your hands dirty and ask your questions directly to the MySQL Utilities team?

Participate in the Hands-on Lab session “DevOps Made Easy with MySQL Utilities” at the 2014 MySQL Central @ OpenWorld conference. See this link for details about the session:

MySQL Community Reception at Oracle OpenWorld:

798 total views, 2 views today

About Paulo Jesus

Paulo Jesus is currently a Principal Software Developer at Oracle, and team lead of the MySQL Fabric (Core) team. He received the BEng degree in systems and informatics in 2001, and the MSc degree in mobile systems in 2007, both from the University of Minho (Portugal). He obtained his PhD degree in 2012, from the MAP-i doctoral program in computer science by the Universities of Minho, Aveiro and Porto (Portugal). He has many years of professional experience as a software developer in relevant companies, and taught informatics during 1 year. He is also an invited researcher at the HASLab / INESC TEC, University of Minho. His research interests include distributed algorithms, fault tolerance, and mobile systems.

Leave a Reply