ERROR 1418 (HY000): This function has none of DETERMINISTIC, NO SQL
今天使用Mysql中,通过create function创建function 的时候出现以下报错,特总结如下: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_function_creators variable)
中文的大概意思是:
此function函数在其声明中没有任何确定,NO SQL或READS SQL DATA,并且启用了二进制日志记录(您可能希望使用较不安全的log_bin_trust_ function_creators变量
解决方法如下:
第一种:
在创建子程序(存储过程、函数、触发器)时,声明为DETERMINISTIC或NO SQL与READS SQL DATA中的一个, 例如: CREATE DEFINER = CURRENT_USER PROCEDURE `NewProc`() DETERMINISTIC BEGIN #Routine body goes here... END;
第二种:
通过信任子程序的创建者,禁止创建、修改子程序时对SUPER权限的要求,设置log_bin_trust_routine_creators全局系统变量为1。
- 设置方法有三种:
- 在客户端上执行SET GLOBAL log_bin_trust_function_creators = 1;
- MySQL启动时,加上--log-bin-trust-function-creators选贤,参数设置为1
- 在MySQL配置文件my.ini或my.cnf中的[mysqld]段上加log-bin-trust-function-creators=1
热门日志
分类
- Django(4)
- ssdb(1)
- Mac(7)
- C(1)
- memcache(1)
- Python(32)
- Vim(8)
- sed(2)
- ansible(3)
- awk(4)
- shell(3)
- about(1)
- git(9)
- bat(4)
- svn(0)
- docker(1)
- Tornado(1)
- go(2)
- 架构(18)
- Vue(1)
- game(2)
- Html(6)
- Java(8)
- Mysql(37)
- Ajax(2)
- Jsp(1)
- Struts(8)
- Linux(72)
- JavaScript(39)
- Staruml(0)
- Mouth(1)
- Php(102)
- Windows(8)
- Message(48)
- Lua(10)
- Compute(1)
- Redis(7)
- Nginx(12)
- Jquery(1)
- Apache(1)
- cocos2d-x(8)