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. Qt4.8在Windows下的三种编程环境搭建

    Qt4.8在Windows下的三种编程环境搭建 Qt的版本是按照不同的图形系统来划分的,目前分为四个版本:Win32版,适用于Windows平台:X11版,适合于使用了X系统的各种Linux和Unix ...

  2. 怎样在万网加入Lync Online SRV记录

    万网已经支持SRV记录解析了,可是有好几个朋友问我怎么加入SRV记录(假设域名提供商不支持,能够通过DNSPOD来实现),过程例如以下 1:绑定域名至Office 365 略,请查看我的视频或者博客中 ...

  3. java日历程序版本

    //MainFrame.java package com.huowolf.myCalender; import java.awt.BorderLayout; import java.awt.Color ...

  4. oracle nologging用法(转)

    一.oracle日志模式分为(logging,force logging,nologging) 默认情况是logging,就是会记录到redo日志中,force logging是强制记录日志,nolo ...

  5. ListView IllegalStateException

    贴出源代码: android.widget.ListView ... if(mItemCount == 0){ resetList(); invokeOnItemScrollListener(); r ...

  6. Oracle SQL Lesson (5) - 使用组函数输出聚合数据

    组函数AVGCOUNTMAXMINSUMVARIANCE:方差STDDEV:标准差 SELECT AVG(salary), MAX(salary), MIN(salary), SUM(salary)F ...

  7. Robotium原则的实施源代码分析

    从前面的章节<Robotium源代码分析之Instrumentation进阶>中我们了解到了Robotium所基于的Instrumentation的一些进阶基础.比方它注入事件的原理等,但 ...

  8. cocos2d触摸事件处理机制(2.x和3.x变化)

    2.x的触摸事件的版本号 触摸事件处理有2种子.以下单点触摸的样本.(另一种多点触摸屏). 创建cocos2d 该项目. 1. 重写下面虚函数. bool ccTouchBegan(cocos2d:: ...

  9. 深度分析 Java 的 ClassLoader 机制(源码级别)(转)

    写在前面:Java中的所有类,必须被装载到jvm中才能运行,这个装载工作是由jvm中的类装载器完成的,类装载器所做的工作实质是把类文件从硬盘读取到内存中,JVM在加载类的时候,都是通过ClassLoa ...

  10. 双向链表实现简单的list

    双向链表结构: 定义一个如下结构体 struct Node { Object data; Node *next; Node *prev; }; 下面为list的具体实现: #include <i ...