2025年MySQL 创建函数报错 you might want to use the less safe log_bin_trust_function_creators variable

MySQL 创建函数报错 you might want to use the less safe log_bin_trust_function_creators variable报错信息 This function has none of DETERMINISTI 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

大家好,我是讯享网,很高兴认识大家。

报错信息: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)

错误原因

这是我们开启了bin-log, 我们就必须指定我们的函数是否是
1、DETERMINISTIC 不确定的
2、NO SQL 没有SQl语句,当然也不会修改数据
3、READS SQL DATA 只是读取数据,当然也不会修改数据
4、MODIFIES SQL DATA 要修改数据
5、CONTAINS SQL 包含了SQL语句

解决方案

思路:可以通过将变量 log_bin_trust_function_creators 的值设置为“开启”实现。

方案一

临时方案,MySQL服务重启会失效


讯享网

查询变量值
show variables like 'log_bin_trust_function_creators';
在这里插入图片描述

设置变量值

set global log_bin_trust_function_creators = 1; show variables like 'log_bin_trust_function_creators'; 

讯享网

在这里插入图片描述

方案二

讯享网log_bin_trust_function_creators = 1 

参考链接:https://www.cnblogs.com/miracle-luna/p/14760051.html

小讯
上一篇 2025-02-09 14:03
下一篇 2025-01-17 12:54

相关推荐

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容,请联系我们,一经查实,本站将立刻删除。
如需转载请保留出处:https://51itzy.com/kjqy/26883.html