Error
Error Code:
1670
MySQL Error 1670: Unsafe Statement in Replication
Description
This error indicates that a SQL statement attempts to interact with or modify system tables (like `mysql.general_log`, `mysql.slow_log`, or `performance_schema`) in a way deemed unsafe for replication. It typically occurs in environments using statement-based binary logging, where such operations could lead to data inconsistencies on replica servers.
Error Message
The statement is unsafe because it uses the general log, slow query log, or performance_schema table(s). This is unsafe because system tables may differ on replicas.
Known Causes
3 known causesDirect Log Table Modification
Executing DML statements (e.g., `INSERT`, `UPDATE`, `DELETE`) directly on `mysql.general_log` or `mysql.slow_log` tables.
Truncating Log Tables
Using `TRUNCATE TABLE` on `mysql.general_log` or `mysql.slow_log`, which is treated as DDL and can cause replication issues.
Unsafe Performance Schema Access
Statements that modify or have side effects on `performance_schema` tables in a manner not compatible with statement-based replication.
Solutions
Coming SoonGeneral Troubleshooting Tips
- Check the error message carefully for specific details
- Review recent changes that might have caused the error
- Search for the exact error code in the official documentation
- Check log files for additional context
- Try restarting the application or service