Enable bin ES1en log mysql error resolution
- 2020-06-03 08:38:51
- OfStack
When a stored procedure is created
Error message:
ERROR 1418 (HY000): This function has none of DETERMINISTIC, NO SQL, or READS SQL DATA in its declaration and binary logging is enabled (you *might* want to use the less safe log_bin_trust_function_creators variable)
The reason:
This is what we started bin-log, We have to specify whether our function is
1 DETERMINISTIC Not sure of
2 NO SQL There is no SQl Statement, of course, does not modify the data
3 READS SQL DATA Just read the data, and of course don't modify the data
4 MODIFIES SQL DATA To modify the data
5 CONTAINS SQL Contains the SQL statements
Among them in function Inside, only DETERMINISTIC, NO SQL and READS SQL DATA Be supported. If we turn it on bin-log, We have to do it for us function The specified 1 A parameter.
Solutions:
SQL code
mysql> show variables like 'log_bin_trust_function_creators';
+---------------------------------+-------+
| Variable_name | Value |
+---------------------------------+-------+
| log_bin_trust_function_creators | OFF |
+---------------------------------+-------+
mysql> set global log_bin_trust_function_creators=1;
mysql> show variables like 'log_bin_trust_function_creators';
+---------------------------------+-------+
| Variable_name | Value |
+---------------------------------+-------+
| log_bin_trust_function_creators | ON |
If mysqld restarts, that parameter will disappear again, so remember to add it in the ES16en.cnf configuration file:
log_bin_trust_function_creators=1