Bug #59800 Create mysql.backup_history table query failed if SQL_MODE=TRADITIONAL
Submitted: 28 Jan 2011 18:01 Modified: 17 Aug 2011 0:44
Reporter: Sveta Smirnova Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Enterprise Backup Severity:S3 (Non-critical)
Version:3.5.2 OS:Any
Assigned to: Ritheesh Vedire CPU Architecture:Any

[28 Jan 2011 18:01] Sveta Smirnova
Description:
If server uses SQL_MODE="TRADITIONAL" mysqlbackup fails to create backup_history table with error: "mysqlbackup: Warning: Backup Logging:  Create mysql.backup_history table query failed with  error 1067: Invalid default value for 'start_time'. This backup operation cannot be logged."

Create table for bakup_history clearly shows the problem:

 CREATE TABLE IF NOT EXISTS mysql.backup_history( 
...
`start_time` TIMESTAMP NOT NULL DEFAULT '0000-00-00 00:00:00',
`end_time` TIMESTAMP NOT NULL DEFAULT '0000-00-00 00:00:00',
...

How to repeat:
mysql> SET GLOBAL SQL_MODE='TRADITIONAL';

shell> mysqlbackup OPTIONS
...
mysqlbackup: Warning: Backup Logging:  Create mysql.backup_history table query failed with  error 1067: Invalid default value for 'start_time'. This backup operation cannot be logged.
mysqlbackup: Warning: Backup Logging: MySQL server cannot create prepared statement for backup history table. Failed with error Table 'mysql.backup_history' doesn't exist. This backup operation cannot be logged.
mysqlbackup: start_lsn: 5294236160
mysqlbackup: incremental_base_lsn: 5294236249
mysqlbackup: end_lsn: 5294239324
mysqlbackup: Warning: Backup Logging: Execution of prepared statement for inserting a row into backup history table failed  with error Unknown prepared statement handler (0) given to mysqld_stmt_execute. This backup operation cannot be logged.

110128 18:49:20 mysqlbackup: mysqlbackup completed OK!

Suggested fix:
Either fix CREATE TABLE statement or temporary modify SQL_MODE when create backup_history table.
[8 Jun 2011 9:44] Ritheesh Vedire
The bug was fixed in 3.6
[17 Aug 2011 0:44] John Russell
Added to 3.6.0 changelog:

If the MySQL server was running with the setting
SQL_MODE=TRADITIONAL, the mysqlbackup command could not create the
backup_history table. This was a minor issue that did not halt the
backup operation.