<p>The statement uses a nondeterministic system function, making it unsafe for statement-based replication and causing Error 1674.</p>
<p>MySQL Error 1674: ER_BINLOG_UNSAFE_SYSTEM_FUNCTION appears when a query calls a nondeterministic system function like NOW() or UUID() while binary logging is set to STATEMENT or MIXED. Switch to ROW logging or rewrite the query without the unsafe function to resolve the issue.</p>
Statement is unsafe because it uses a system function
Error 1674 triggers when you execute a statement that invokes a nondeterministic system function while the server is using STATEMENT or MIXED binary logging format. MySQL marks the statement as unsafe because the function could return different values on replicas, breaking data consistency.
Statement-based replication replays SQL text on replicas. If the function gives a different result on the replica, tables diverge silently. Stopping the statement and warning the user protects data integrity across the primary and replicas.
The error surfaces during writes that call functions such as NOW(), SYSDATE(), UUID(), RAND(), or LOAD_FILE(). It also appears in triggers, stored procedures, and CREATE TABLE ... SELECT constructs that reference the same nondeterministic functions.
Use one of three approaches: switch the global binlog_format to ROW, capture the function value into a variable and reuse it, or replace the function with a deterministic alternative. These changes allow the statement to be logged safely.
No. Ignoring the error risks replica drift, making future analytics and failover impossible to trust. Always correct the statement or adjust the logging mode before re-executing the query.
Timestamp functions return different values on each server, so MySQL blocks statement logging.
Unique identifiers and random numbers differ per host, producing non-identical rows on replicas.
Nondeterministic calls hidden inside stored code are still unsafe under STATEMENT or MIXED formats.
File system reads may succeed on the primary but fail on replicas due to different paths or permissions.
General warning for other nondeterministic constructs, not limited to system functions.
Occurs when inserting into tables with AUTO_INCREMENT and SELECT in STATEMENT mode.
Shows up when UPDATE uses LIMIT without ORDER BY, leading to unpredictable row order.
Row logging slightly increases log volume, but modern storage and compression minimize the difference. The consistency gain usually outweighs the cost.
Yes. Use SET SESSION binlog_format after connecting to override the global setting temporarily.
In MIXED mode, MySQL tries STATEMENT first and falls back to ROW only when it detects safety. Some unsafe functions are blocked before fallback.
Galaxy highlights unsafe functions, offers AI rewrite suggestions, and lets teams enforce lint rules that ban nondeterministic calls in shared queries.