Error
Error Code:
1695
MariaDB Error 1695: Cannot Change Binary Log
Description
This error indicates an attempt to modify the `sql_log_bin` system variable from within a stored function or trigger. MariaDB (and MySQL) prevents this operation to maintain data integrity and consistent binary logging behavior, which is crucial for replication and point-in-time recovery. It ensures that all DML statements executed by stored programs are consistently logged or not logged based on the session's initial setting.
Error Message
Cannot change the sql_log_bin inside a stored function or trigger
Known Causes
4 known causesDirect `sql_log_bin` Modification
An explicit `SET sql_log_bin` statement is present within the code of a stored function or trigger, attempting to alter the binary logging status.
Misunderstanding Execution Context
The developer might not be aware that `sql_log_bin` cannot be altered from within the restricted scope of stored programs, which have specific limitations on system variable changes.
Replication or Logging Requirements
The stored program logic implicitly or explicitly relies on changing binary logging behavior for specific operations, which is not permitted for consistency.
Legacy Code or Migration
Code from an older database environment or a different RDBMS where such operations might have been allowed was migrated without modification to MariaDB.
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