【MySQL案件】ERROR 1418
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的更多相关文章
- 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 ...
- MySQL创建函数报“ERROR 1418 ”错误,不能创建函数
MySQL创建函数报ERROR 1418错误,不能创建函数,根据官方提示是说,不能创建函数可能是一个安全设置方面的配置或功能未开启原因,下面我们一起来看. 错误 ERROR 1418 (HY000 ...
- 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 ...
- mysql: Error Codes and Messages
Appendix B. Error Codes and MessagesTable of Contents B.1. Server Error Codes and MessagesB.2. Clien ...
- Discuz! X3搬家后UCenter出现UCenter info: MySQL Query Error解决方案
Discuz! X3 X2.5论坛搬家后 登录UCenter出现报错:UCenter info: MySQL Query ErrorSQL:SELECT value FROM [Table]vars ...
- 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 ...
- MySQL Replication Error 处理一例
故障现象 MySQL slave status详情 mysql> show slave status\G *************************** 1. row ********* ...
- 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 ...
- xampp启动MySQL出现Error: MySQL shutdown unexpectedly.
20175227张雪莹 2018-2019-2 <Java程序设计> xampp启动MySQL出现Error: MySQL shutdown unexpectedly. 问题 本周在学习教 ...
随机推荐
- cocos2d-x3.0 实现HTTP请求GET、POST
HTTP请求实现 把以下代码拷贝到新创建的project中就能看到效果 HelloWorldScene.h #include "cocos2d.h" /*记得要引头文件*/ #in ...
- HDU 4998 Rotate
题意: n次旋转 每次平面绕ai点旋转pi弧度 问 最后状态相当于初始状态绕A点旋转P弧度 A和P是多少 思路: 如果初始X点的最后状态为X'点 则圆心一定在X和X'连线的垂直平分线上 那 ...
- POJ 1515 Street Directions
题意: 一幅无向图 将尽量多的无向边定向成有向边 使得图强连通 无向图保证是连通的且没有重边 思路: 桥必须是双向的 因此先求边双连通分量 并将桥保存在ans中 每一个双连通分量内的边一定都 ...
- Android 权限添加
在AndroidMainFest.xml中加上以下代码就行了 添加WiFi以及访问网络的权限: <uses-permission android:name="android.permi ...
- mysql替换字段里数据内容部分字符串(亦可用于增加字段中的内容)
mysql替换表的字段里面内容,如例子: mysql> select host,user from user where user='testuser'; +----------------- ...
- log4net和一般的记录日志方法
下载 http://files.cnblogs.com/crazyair/log4net.zip 1 在web项目中新建一个 Log4Net.config <?xml version=" ...
- Mega的简单使用
Table of Contents 1 Mega画树的简单应用 2 fas格式文件的准备 3 用生成的.meg画树 4 生出树的处理 4.1 修改内容,添加标注 4.2 导出 4.3 后面随着学习的进 ...
- php学习笔记--error
不同的错误处理方法: 简单的die()语句 自己定义错误函数和错误触发器 错误报告 主要的错误处理:使用die()函数 if(!file_exists("welcome.txt") ...
- Oracle 阅读器-刚看完表空间回复的详细解释
(一) 当使用一个控制文件的备份恢复,例如下面的附图.使用备份控制文件恢复位置 watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvZGVtb25zb24=/fo ...
- 使用Ratpack和Spring Boot打造高性能的JVM微服务应用
使用Ratpack和Spring Boot打造高性能的JVM微服务应用 这是我为InfoQ翻译的文章,原文地址:Build High Performance JVM Microservices wit ...