MySQL 创建函数失败提示1418
在创建函数时,往往会遇到创建函数失败的情形,除去书写的创建函数的sql语句本身语法错误之外,还会碰到一个错误就是,
1418: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)
当提示这种错误的时候,解决方法如下:
一、查看创建函数的功能是否开启:
mysql> show variables like '%func%';
+-----------------------------------------+-------+
| Variable_name | Value |
+-----------------------------------------+-------+
| log_bin_trust_function_creators | ON |
+-----------------------------------------+-------+
1 row in set (0.02 sec)
+-----------------------------------------+-------+
| Variable_name | Value |
+-----------------------------------------+-------+
| log_bin_trust_function_creators | ON |
+-----------------------------------------+-------+
1 row in set (0.02 sec)
二、如果Value处值为OFF,则需将其开启。
mysql> set global log_bin_trust_function_creators=1;
mysql> set global log_bin_trust_function_creators=1;
三、创建函数
语法略过,可以通过Navicat工具操作,简单快捷