Error
Error Code:
1667
MySQL Error 1667: Binary Log Conflict Multiple Engines
Description
This error indicates that MySQL cannot write the current statement to its binary log. It occurs when a single SQL statement attempts to interact with tables that use more than one storage engine, and at least one of those engines (such as NDB Cluster) has its own internal logging mechanism that conflicts with MySQL's global binary logging for mixed-engine operations.
Error Message
Cannot execute statement: impossible to write to binary log since more than one engine is involved and at least one engine is self-logging.
Known Causes
3 known causesMixed Storage Engines in Operation
The executed SQL statement attempts to modify or access tables that are configured to use different storage engines (e.g., InnoDB and NDB Cluster).
Self-Logging Engine Involvement
An engine with its own internal logging capabilities (like NDB for MySQL Cluster) is part of the statement, creating a conflict with MySQL's global binary log when other engines are present.
Transactional Atomicity Constraints
MySQL's binary logging cannot guarantee atomic writes for a statement spanning multiple, potentially non-transactional, or self-logging engines.
Solutions
3 solutions available1. Disable Binary Logging for Non-Transactional Tables easy
Temporarily disable binary logging for tables that don't support transactions if they are causing the conflict.
1
Identify tables that are causing the conflict. This often involves tables using engines like MyISAM if you have a mixed-engine environment and binary logging enabled.
SELECT TABLE_SCHEMA, TABLE_NAME, ENGINE FROM information_schema.TABLES WHERE ENGINE NOT IN ('InnoDB', 'NDBCLUSTER');
2
Temporarily disable binary logging for the affected tables. This is a quick fix and might not be suitable for long-term production environments if replication is critical.
SET GLOBAL binlog_format = 'ROW'; -- Or 'STATEMENT' or 'MIXED' depending on your setup
SET GLOBAL log_bin = ON; -- Ensure binary logging is enabled globally
-- For specific tables, especially if they are not InnoDB:
-- You might need to alter the table or its creation process to ensure it's compatible with binlogging.
-- However, a more direct approach for this error is to ensure all tables are transactional or to manage the binlog format.
3
Alternatively, if the problematic tables are not critical for replication or point-in-time recovery, consider migrating them to InnoDB or excluding them from the binary log. For a quick resolution, you might reconfigure the `binlog_format` to 'ROW' if it's not already, and ensure all tables are transactional (InnoDB). If you have MyISAM tables, this error is likely.
SET GLOBAL binlog_format = 'ROW';
-- If you have MyISAM tables, you should plan to migrate them to InnoDB.
2. Migrate All Tables to a Transactional Storage Engine medium
Convert all tables to InnoDB to ensure binary log compatibility.
1
Identify tables that are not using a transactional engine like InnoDB.
SELECT TABLE_SCHEMA, TABLE_NAME, ENGINE FROM information_schema.TABLES WHERE ENGINE != 'InnoDB';
2
For each non-InnoDB table, convert it to InnoDB. This is the most robust solution as it ensures all tables are transactional and compatible with binary logging.
ALTER TABLE `your_database`.`your_table` ENGINE=InnoDB;
3
After migrating all relevant tables, restart the MySQL server to ensure changes are fully applied and the binary log is handled correctly.
sudo systemctl restart mysql # On systems using systemd
# Or consult your OS's specific service management command.
3. Adjust Binary Log Format easy
Ensure the binary log format is set to 'ROW' or 'MIXED' and all involved tables are transactional.
1
Check the current binary log format.
SHOW VARIABLES LIKE 'binlog_format';
2
If the format is not 'ROW' or 'MIXED', or if you suspect it's contributing to the issue with self-logging engines, change it to 'ROW'. This is generally the most compatible format for replication and point-in-time recovery.
SET GLOBAL binlog_format = 'ROW';
3
To make this change permanent, update your MySQL configuration file (e.g., `my.cnf` or `my.ini`) and restart the MySQL server.
[mysqld]
binlog_format = ROW
4
Restart the MySQL server.
sudo systemctl restart mysql # On systems using systemd
# Or consult your OS's specific service management command.