Error
Error Code:
1674
MySQL Error 1674: Unsafe System Function Replication
Description
This error indicates that a SQL statement contains a system function whose output might differ between the primary server and a replica. Such non-deterministic functions can lead to data inconsistencies when using statement-based or mixed-mode replication, making the statement "unsafe" for replication.
Error Message
Statement is unsafe because it uses a system function that may return a different value on the replica.
Known Causes
3 known causesUsing Non-Deterministic Functions
The SQL statement includes functions like UUID(), NOW(), or RAND() which produce different results each time they are executed, potentially causing replication divergence.
Statement-Based Binlog Format
The server's binlog_format is set to STATEMENT, which logs SQL statements directly, making non-deterministic functions problematic for replication safety.
Context-Sensitive System Functions
Functions such as LAST_INSERT_ID() or USER() can return values specific to the current session or server environment, leading to discrepancies on replicas.
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