在MySQL8.0.19上创建函数,报错:
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)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)
原因:未开启函数功能。
查询:show variables like '%func%';
如下图:
![]()
开启函数功能:set global log_bin_trust_function_creators=1;
再次查询,如下图:
![]()
这样,就可以创建函数了。
备注:这个动态设置的方式会在服务重启后失效。因此,要在my.ini配置文件中加上该配置log_bin_trust_function_creators=1。
本文详细解释了在MySQL8.0.19版本中创建函数时遇到的ERROR1418错误,并提供了具体的解决方案。通过调整log_bin_trust_function_creators变量,可以成功开启函数功能,实现函数的正常创建。
553

被折叠的 条评论
为什么被折叠?



