1.1.1. ERROR 1418

【环境的叙述性说明】

mysql5.0.67

【问题叙述性说明】

当它来到创建存储过程ERROR 1418一个错误。

# 创建函数SQL声明

CREATE FUNCTION `xxx`( num01 int ) RETURNSint(11)

begin

declare mm  int default 0;

if  (xx) then

set mm = num01*num01*10;

elseif  xxx then

set mm = 10;

else

case num01

when  30 then set mm = 111;

when  31 then set mm = 222;

end case;

end if;

return mm;

end

# 报错信息

# ERROR 1418 (HY000) at line xxxxx: Thisfunction has none of DETERMINISTIC, NO SQL, or READS SQL DATA in itsdeclaration and binary logging is enabled (you *might* want to use the lesssafe log_bin_trust_function_creators variable)

【解决方法】

关闭关闭binary log或者改动參数。

此处採用改动參数的方法:

set globallog_bin_trust_function_creators=1;

【报错原因】

By default, for a CREATE FUNCTION
statement to be accepted, at least one of
DETERMINISTIC,
NOSQL, or READS SQL DATA
must be specified explicitly. Otherwise an error occurs:

ERROR1418 (HY000): This function has none of DETERMINISTIC, NO SQL,

or READSSQL DATA in its declaration and binary logging is enabled

(you*might* want to use the less safe log_bin_trust_function_creators

variable)

If you set log_bin_trust_function_creators
to 1, the requirement that functions be

deterministic or not modify data is dropped.

【參考资料】

Command-LineFormat --log-bin-trust-function-creators

Option-FileFormat log-bin-trust-function-creators

SystemVariable Name log_bin_trust_function_creators

VariableScope Global

DynamicVariable Yes

PermittedValues

Type boolean

Default FALSE

This variable applieswhen binary logging is enabled. It controls whether stored function creators canbe trusted not to create stored functions that will cause unsafe events to bewritten to the binary log. If set to
0 (the default), users are not permittedto create or alter stored functions unless they have the
SUPER privilege in addition to the
CREATE ROUTINE or
ALTER ROUTINE privilege. A setting of0 also enforces the restriction that a function must be declared with the
DETERMINISTIC characteristic, or with the
READS SQL DATA or
NO SQL characteristic. If the variable is set to 1, MySQLdoes not enforce these restrictions on stored function creation. This variablealso applies to trigger creation. See
Section19.7, “Binary Logging of Stored Programs”.

版权声明:本文博客原创文章。博客,未经同意,不得转载。

【MySQL案件】ERROR 1418的更多相关文章

  1. Mysql ERROR 1418 (HY000): This function has none of DETERMINISTIC, NO SQL, or READS SQL DATA

    ERROR 1418 (HY000): This function has none of DETERMINISTIC, NO SQL, or READS SQL DATA in its declar ...

  2. MySQL创建函数报“ERROR 1418 ”错误,不能创建函数

    MySQL创建函数报ERROR 1418错误,不能创建函数,根据官方提示是说,不能创建函数可能是一个安全设置方面的配置或功能未开启原因,下面我们一起来看.   错误 ERROR 1418 (HY000 ...

  3. mysql 创建函数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_f

    mysql 创建函数的时候 报错 ERROR 1418 (HY000): This function has none of DETERMINISTIC, NO SQL, or READS SQL D ...

  4. mysql: Error Codes and Messages

    Appendix B. Error Codes and MessagesTable of Contents B.1. Server Error Codes and MessagesB.2. Clien ...

  5. Discuz! X3搬家后UCenter出现UCenter info: MySQL Query Error解决方案

    Discuz! X3 X2.5论坛搬家后 登录UCenter出现报错:UCenter info: MySQL Query ErrorSQL:SELECT value FROM [Table]vars ...

  6. Mysql update error: Error Code: 1175. You are using safe update mode and you tried to update a table

    Mysql update error: Error Code: 1175. You are using safe update mode and you tried to update a table ...

  7. MySQL Replication Error 处理一例

    故障现象 MySQL slave status详情 mysql> show slave status\G *************************** 1. row ********* ...

  8. mysql启动报错 mysql InnoDB: Error: could not open single-table tablespace file

    mysql启动不成功,报错 mysql InnoDB: Error: could not open single-table tablespace file innodb_force_recovery ...

  9. xampp启动MySQL出现Error: MySQL shutdown unexpectedly.

    20175227张雪莹 2018-2019-2 <Java程序设计> xampp启动MySQL出现Error: MySQL shutdown unexpectedly. 问题 本周在学习教 ...

随机推荐

  1. codeforces293E (树上点分治+树状数组)

    和poj1747相比起来,只不过是限制条件多了一维. 而多了这一维,所以需要用树状数组来维护,从而快速得到答案. 因为没注意传进树状数组函数的参数可能是<=0的,导致超时了好久. #pragma ...

  2. 一篇哥们自己的写的IBM电话面试感想-@大国

    两天没写博了,还是没有养成一个习惯.前天和昨天休息,和哥们几个出去打球,运动一下,放松下脑子.今天就补一篇我哥们自己的写的关于他的IBM电话面试的感想,希望能帮到有需要的人. ------------ ...

  3. Android 关于资源适配

    一. 关于图片资源 图片宽高 不要固定大小,在小屏幕和大屏幕,不同分频率上 ,採用不同的图片,这个要美工切图的. 不同的分辨率,界面的长宽比不一致,须要不同规格的图片 在drawable-hdpi,d ...

  4. VS2015配置Andriod开发环境

    原文:VS2015配置Andriod开发环境 折腾了好久终于配置OK了,分享给大家! 第一步: http://xamarin.com/download下载XamarinInstaller 第二步: 运 ...

  5. Linux 软连接与硬连接

    Linux 软连接与硬连接 对于一个文件来说,有唯一的索引接点与之相应,而对于一个索引接点号,却能够有多个文件名称与之相应.因此,在磁盘上的同一个文件能够通过不同的路径去訪问该文件.注意在Linux下 ...

  6. HDU 4360 As long as Binbin loves Sangsang spfa

    题意: 给定n个点m条边的无向图 每次必须沿着LOVE走,到终点时必须是完整的LOVE,且至少走出一个LOVE, 问这样情况下最短路是多少,在一样短情况下最多的LOVE个数是多少. 有自环. #inc ...

  7. CSS预处理器——Sass、LESS和Stylus实践

    CSS(Cascading Style Sheet)被译为级联样式表,做为一名前端从业人员来说,这个专业名词并不陌生,在行业中通常称之为“风格样式表(Style Sheet)”,它主要是用来进行网页风 ...

  8. 重新想象 Windows 8 Store Apps (15) - 控件 UI: 字体继承, Style, ControlTemplate, SystemResource, VisualState, VisualStateManager

    原文:重新想象 Windows 8 Store Apps (15) - 控件 UI: 字体继承, Style, ControlTemplate, SystemResource, VisualState ...

  9. lua 远程调试 【zeroBrane 使用mobdebug】(good转)

    最近基于业务需求,学习了如何使用zeroBrane这个IDE实现C/S 模式下的 lua远程调试,废话不多,上效果图: ---------------------------------------- ...

  10. Swift新手教程3-字符串String

    原创blog,转载请注明出处 String 在swfit中,String兼容Unicode的方式.用法和C语言类似. 注意   在Cocoa和Cocoa touch中,Swift的String,和Fo ...