目录
1.问题背景:
在创建自定义函数时遇到错误:
创建一个现实时间的函数:
create function show_time() returns varchar(30)
return date_format(now(), ‘%Y年%m月%d日 %H时%i分%s秒’);
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参数缺省0,是不允许function的同步的,一般我们在配置repliaction的时候,都忘记关注这个参数,这样在master更新funtion后,slave就会报告错误,然后slave stoped。
2.解决方法:
方法 1.登陆mysql数据库
set global log_bin_trust_function_creators = 1