MySQL Utilities

5.5 mysqlbinlogrotate — Binary log rotate utility

This utility rotates the binary log by closing the active binary log file and opening a new binary log file.

The user must provide the server connection parameters with the --server option.

The user can also use the --min-size option to conditionally rotate the active binary log file only if the file size exceeds the specified value in bytes.

OPTIONS

mysqlbinlogrotate accepts the following command-line options:

NOTES

By default, the utility rotates only the active binary log file, but for MySQL Server versions prior to 5.5.3, other log files (i.e, error log, relay log, slow log) are also rotated.

The path to the MySQL client tools should be included in the PATH environment variable in order to use the authentication mechanism with login-paths. This permits the utility to use the my_print_defaults tools which is required to read the login-path values from the login configuration file (.mylogin.cnf).

EXAMPLES

Rotate the active binary log file and display the new filename.

shell> mysqlbinlogrotate --server=root:root@localhost:3310 -v
# Checking user permission to rotate binary logs...
#
# Active binlog file: 'mysql-bin.000002' (size: 32054 bytes)
# The binlog file has been rotated.
# New active binlog file: 'mysql-bin.000003'

Rotate the active binary log file only if his size exceeds 1GB (1073741824 bytes) and display new filename.

shell> mysqlbinlogrotate --server=root:root@localhost:3310 \
          --min-size=1073741824 -v
# Checking user permission to rotate binary logs...
#
# Active binlog file: 'mysql-bin.000002' (size: 1610612736 bytes)
# The binlog file has been rotated.
# New active binlog file: 'mysql-bin.000003'

PERMISSIONS REQUIRED

By default, the user used to connect to the server must have permissions to rotate the binary logs, more precisely the SUPER and REPLICATION SLAVE privileges are required.