MySQL创建函数报错:1418 - This function has none of DETERMINISTIC, NO SQL, or READS SQL DATA in its declaration and binary logging is enabled

创建函数时报错:

1418 - 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)

问题原因:

原因是开启了log-bin日志,创建函数时,函数中没有包含DETERMINISTIC, NOSQL和 READS SQL DATA声明,即没有涉及修改数据。

解决办法:

(1)、查出log_bin_trust_function_creators的值
mysql--> show variables like 'log_bin_trust_function_creators'

log_bin_trust_function_creators OFF

(2)、修改该值为ON
mysql-->set global log_bin_trust_function_creators=1;

如果需要恢复,修改该值为OFF
mysql-->set global log_bin_trust_function_creators=0;

posted @ 2023-03-06 22:16  业余砖家  阅读(169)  评论(0编辑  收藏  举报