第一次写Mysql函数的时候报的这个错误,分享一下。

1.先查看函数功能是否开启:show variables like '%func%';
2.开启:SET GLOBAL log_bin_trust_function_creators = 1;
3.关闭:SET GLOBAL log_bin_trust_function_creators = 0;
----------------------------效果👇👇👇----------------------------------------
改之前:

改之后:

参考文献:
1.https://blog.youkuaiyun.com/lv_hang515888/article/details/78094889
2.https://blog.youkuaiyun.com/weixin_39782433/article/details/113170917
这篇博客分享了在MySQL中遇到的创建函数时的错误及解决方案。首先,通过`SHOW VARIABLES LIKE '%func%'`检查函数功能是否开启。如果未开启,可以使用`SET GLOBAL log_bin_trust_function_creators=1`来临时开启,完成后再用`SET GLOBAL log_bin_trust_function_creators=0`关闭。参考了两篇优快云博客文章进行了解决。
6836





