MEB copies binary logs and relay logs to support PITR and cloning of master/slave
4 stars based on
The server writes these files in binary format. To display their contents in text format, use the mysqlbinlog utility.
You can also use mysqlbinlog to display the contents of relay log files written by a slave server in a replication setup because relay logs have the same format as binary logs. Invoke mysqlbinlog like this:. For example, to display the contents of the binary log file named binlog. The output includes events contained in binlog. For statement-based logging, event information includes the SQL statement, the ID of the server on which it was executed, the timestamp when the statement was executed, how much time it took, and so forth.
For row-based logging, the event indicates a row change rather than an SQL statement. Events are preceded by header comments that provide additional information.
In the first line, the number following at indicates the file offset, or starting position, of the event in the binary log file. The second line starts with a date and time indicating when the statement started on the server where the event originated. For replication, this timestamp is propagated to slave servers. On a slave, it is the difference of the end execution time on the slave minus the beginning execution time on the master.
The difference serves as an indicator of how much replication lags behind the master. Zero means that no error occurred. When using event groups, the file offsets of events may be grouped together and the comments of events may be grouped together. Do not mistake these grouped events for blank file offsets. The output mysqlbinlog restore error mysqlbinlog can be re-executed for example, by using it as input to mysql to redo the statements in mysqlbinlog restore error log.
This is useful for recovery operations after a server crash. Normally, you use mysqlbinlog to read binary log files directly and apply them to the local MySQL server. It is also possible to read binary mysqlbinlog restore error from a remote server by using the --read-from-remote-server option. To read remote binary logs, the connection parameter options can be given to indicate how to connect to the server.
These options are --host--password--port--protocol--socketand --user ; they are ignored except when you mysqlbinlog restore error use the --read-from-remote-server option.
When running mysqlbinlog against a large binary log, mysqlbinlog restore error careful that the filesystem has enough space for the resulting files. The option has these permissible values not case sensitive:. Automatic BINLOG display is the only safe behavior if you intend to use the output of mysqlbinlog to re-execute binary log file contents.
The other option values are intended only for debugging or testing purposes because they may produce output that does not include all events in executable form. The --baseoutput option was introduced in MySQL 5. The option values described in the preceding list may be used as of MySQL 5. On a computer having multiple network interfaces, use this option to select which interface to use for connecting to the MySQL server.
It is not available in standard MySQL 5. The directory where character sets are installed. The --database mysqlbinlog restore error for mysqlbinlog is similar to the --binlog-do-db option for mysqldbut can be used to specify only one database. If --database is given multiple times, only the last instance is used. The effects of this option depend on whether the statement-based or row-based logging format is in use, in the same way that the effects of --binlog-do-db depend on whether statement-based or row-based logging is in use.
The --database option works as follows:. The database being created, altered, or dropped is considered to be the default database when determining whether to output the statement.
Suppose that the binary log was created by executing these statements using statement-based-logging:. The default database has no effect on this. Suppose that the binary log just described was created using row-based logging rather than statement-based logging.
In particular, no cross-database updates should be used. This option mysqlbinlog restore error not work correctly for mysqlbinlog with row-based logging prior to MySQL 5. Write a debugging log. Mysqlbinlog restore error default is d: Print some mysqlbinlog restore error information when the program exits. This option was added in MySQL 5. Print debugging information and memory and CPU usage statistics when the program exits. Read this option file after the global option file but on Unix before the user option file.
If the file does not exist or is otherwise inaccessible, an error occurs. Use only the given mysqlbinlog restore error file. Read not only the usual option groups, but also groups with mysqlbinlog restore error usual names and a suffix of str. For example, mysqlbinlog normally reads the [client] and [mysqlbinlog] groups. This is useful for avoiding an endless loop if you use the --to-last-log option and are sending the output to the same MySQL mysqlbinlog restore error. This mysqlbinlog restore error also is useful when restoring after a crash to avoid duplication of the statements you have logged.
Read binary log files even if they are open or were not closed properly. With this option, if mysqlbinlog reads a binary log event that it does not recognize, it prints a warning, ignores the event, and continues. Without this option, mysqlbinlog stops if it reads such an event. The hex output can be helpful for replication debugging.
These temporary files are not automatically removed by mysqlbinlog or any other MySQL program. Do not read any option files.
If program startup fails due to reading unknown options from an option file, --no-defaults can be used to prevent them from being read. Skip the first N entries in the log. The password to use when connecting to the server. If you use the short option form -pyou cannot have a mysqlbinlog restore error between the option and the password. If you omit the password value following the --password or -p option on the command line, mysqlbinlog prompts for one.
Specifying a password on the command line should be considered insecure. You can use an option file to avoid giving the password on the command line. The connection protocol to use for connecting to the server. It is useful when the other connection parameters normally would cause a protocol to be used other than the one you want. Read the binary log from a MySQL server rather than reading a local log file.
Any connection parameter options are ignored unless this option is given as well. These options are --host--password--port--protocol--socketand --user.
This option requires that the remote server be running. It works only for binary log files on the remote server, not relay log files. Display only those events created by the server having mysqlbinlog restore error given server ID.
This mysqlbinlog restore error is available as of MySQL 5. If the binary log was written by a mysqld with server-id-bits set to less than 32 and user data stored in the most significant bit, running mysqlbinlog with --server-id-bits set to 32 enables this data to be seen.
On Windows, the shared-memory mysqlbinlog restore error to use, for mysqlbinlog restore error made using shared memory to a local server.
The shared-memory name mysqlbinlog restore error case sensitive. The server must be started with the --shared-memory option to enable mysqlbinlog restore error connections. Display only the statements contained in the log, without any extra information or row-based events. This is for testing only, and should not be used in production systems. For connections to localhostthe Unix socket file to use, or, on Windows, the name of the named pipe to use.
Start reading the binary log at the first event having a timestamp equal to or later than the datetime argument. The datetime value is relative to the local time zone on the machine where you run mysqlbinlog.
This option is useful for point-in-time recovery. Start reading the binary log at the first event having a position equal to or greater than N. This option applies to the first log file named on the command line.
Stop reading the binary log at the first event having a timestamp equal to or later than the datetime argument. See the description of the --start-datetime option for information about the datetime value. Stop reading the binary log at the first event having a position equal to or greater than N. This option applies to the last log file named on the command line. Do not stop at the end of the requested binary log from a MySQL server, but rather continue printing until the end of the last binary log.
If you send the output to the same MySQL server, this may lead to an endless loop. This option requires --read-from-remote-server. Reconstruct row events and display them as commented SQL statements. If this option is given mysqlbinlog restore error, the output includes comments to indicate column data types and some metadata. You can pipe the output of mysqlbinlog into the mysql client to execute the events contained in the binary log. You can also redirect the output of mysqlbinlog to a text file instead, if you need to modify the statement log first for example, to remove statements that you do not want to execute for some reason.