本文章来给大家介绍关于MySQL创建函数出现1418错误解决方法,出现这种问题我们只要简单的一句就可以解决了.
错误码:1418
- ThisfunctionhasnoneofDETERMINISTIC,NOSQL,orREADSSQLDATAinitsdeclarationandbinaryloggingisenabled(you*might*wanttousethelesssafelog_bin_trust_function_creatorsvariable)这个是创建函数功能未开。
- (you*might*wanttousethelesssafelog_bin_trust_function_creatorsvariable)
- (0mstaken)
分析:根据系统提示,导致该错误的原因可能是一个安全设置方面的配置,查手册.
log_bin_trust_function_creators参数缺省0,是不允许function的同步的,一般我们在配置repliaction的时候,都忘记关注这个参数,这样在master更新funtion后,slave就会报告错误,然后slave stoped.
处理过程:登陆mysql数据库.
- >setgloballog_bin_trust_function_creators=1;
- >startslave;
- mysql>setog_bin_trust_function_creators=1;
- ERROR1193(HY000):Unknownsystemvariable'og_bin_trust_function_creators'
- mysql>setlog_bin_trust_function_creators=1;
- ERROR1229(HY000):Variable'log_bin_trust_function_creators'isaGLOBALvariableandshouldbesetwithSETGLOBAL
- mysql>setgloballog_bin_trust_function_creators=1;
- QueryOK,0rowsaffected(0.00sec)
- mysql>showvariablelike'%func%';
- ERROR1064(42000):YouhaveanerrorinyourSQLsyntax;checkthemanualthatcorrespondstoyourMySQLserverversionfortherightsyntaxtousenear'variablelike'%func%''atline1
- mysql>showvariableslike'%func%';
- +---------------------------------+-------+
- |Variable_name|Value|
- +---------------------------------+-------+
- |log_bin_trust_function_creators|ON|
- +---------------------------------+-------+
- 1rowinset(0.01sec)--phpfensi.com
- mysql>commit;
- QueryOK,0rowsaffected(0.00sec)
- mysql>
跟踪mysql的启动日志,slave正常运行,问题解决.