先看问题:
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)
解决办法:
- 查看log_bin_trust_function_creators变量的值:
show variables like '%log_bin%';
- 修改变量值
①临时设置变量
set global log_bin_trust_function_creators=ON;
# 或者
set global log_bin_trust_function_creators=TRUE;
②永久修改变量
log_bin_trust_function_creators这个变量和变量值 直接写入MySQL的主配置文件 my.cnf 即可。1代表on,0代表off
set GLOBAL log_bin_trust_function_creators=1
写入配置文件的变量和变量值不会随服务重启而失效,是永久有效的。
如果这个log_bin_trust_function_creators的值是off,那么,此时将不能执行生成函数,值为on的时候可以执行生成函数。