an error message The binary log file_name  is shorter than its expected size . In this case, this binary log is not correct and replication should be restarted from a fresh snapshot of the source’s data. 

The session values of the following system variables are written to the binary log and honored by the replica when parsing the binary log: 

• sql_mode  (except that the NO_DIR_IN_CREATE  mode is not replicated; see Section 17.5.1.39, “Replication and Variables” ) 

## 5.4.4.1 Binary Logging Formats 

• foreign_key_checks 

• unique_checks 

• character_set_client 

• collation_connection 

• collation_database 

• collation_server 

• sql_auto_is_null 

The server uses several logging formats to record information in the binary log: 

•Replication capabilities in MySQL originally were based on propagation of SQL statements from source to replica. This is called statement-based logging . You can cause this format to be used by starting the server with --binlog-format=STATEMENT . 

•In row-based logging  (the default), the source writes events to the binary log that indicate how individual table rows are affected. You can cause the server to use row-based logging by starting it with -- binlog-format=ROW . 

•A third option is also available: mixed logging . With mixed logging, statement-based logging is used by default, but the logging mode switches automatically to row-based in certain cases as described below. You can cause MySQL to use mixed logging explicitly by starting mysqld  with the option --binlog- format=MIXED . 

The logging format can also be set or limited by the storage engine being used. This helps to eliminate issues when replicating certain statements between a source and replica which are using different storage engines. 

With statement-based replication, there may be issues with replicating nondeterministic statements. In deciding whether or not a given statement is safe for statement-based replication, MySQL determines whether it can guarantee that the statement can be replicated using statement-based logging. If MySQL cannot make this guarantee, it marks the statement as potentially unreliable and issues the warning, Statement may not be safe to log in statement format . 

## 5.4.4.2 Setting The Binary Log Format 

You can avoid these issues by using MySQL’s row-based replication instead. 

You can select the binary logging format explicitly by starting the MySQL server with --binlog- format= type . The supported values for type  are: 

