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
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.
mysqlbinlogrotate accepts the following command-line options:
Shows the program's version number.
Displays the help message.
Connection information for the server.
To connect to a server, it is necessary to specify connection parameters such as the user name, host name, password, and either a port or socket. MySQL Utilities provides a number of ways to supply this information. All of the methods require specifying your choice via a command-line option such as --server, --master, --slave, etc. The methods include the following in order of most secure to least secure.
Use login-paths from your
.mylogin.cnffile (encrypted, not visible). Example :
Use a configuration file (unencrypted, not visible) Note: available in release-1.5.0. Example :
Specify the data on the command-line (unencrypted, visible). Example :
Specifies if the server connection requires use of SSL. If an encrypted connection cannot be established, the connection attempt fails. By default 0 (SSL not required).
The path to a file that contains a list of trusted SSL CAs.
The name of the SSL certificate file to use for establishing a secure connection.
The name of the SSL key file to use for establishing a secure connection.
Rotate the active binary log file only if the file size exceeds the specified value in bytes.
Specify how much information to display. Use this option multiple times to increase the amount of information. For example,
-vv= more verbose,
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).
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'
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.