MySQL Workbench下create function时报错:
Error Code: 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_trust_function_creators的值,记不清完整名称,可以使用通配符查看
show variables like '%func%';
输出结果:
发现全局变量log_bin_trust_function_creators的值的值为OFF。
接下来,将该全局变量的值设置为ON(或1)。
set global log_bin_trust_function_creators=1;
之后,create function命令创建自定义函数成功。