解决Mysql报错:This function has none of DETERMINISTIC, NO SQL, or READS SQL DATA in its de

错误信息

创建函数时报错信息

[Err] 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)

错误分析

我们就必须指定我们的函数是否是
  • DETERMINISTIC 不确定的
  • NO SQL 没有SQl语句
  • READS SQL DATA 只是读取数据
  • MODIFIES SQL DATA 要修改数据
  • CONTAINS SQL 包含SQL语句

其中在function/procedure 里面,只有 DETERMINISTIC, NO SQL 和 READS SQL DATA 被支持。如果我们开启了 bin-log, 我们就必须为我们的function/procedure 指定一个参数。

解决方法

1.在mysql数据库中执行以下语句 (临时生效,重启后失效)
set global log_bin_trust_function_creators=TRUE;

或者

set global log_bin_trust_function_creators=1;

2. 在配置文件/etc/my.cnf的[mysqld]或者my-default.ini文件中配置log_bin_trust_function_creators=1

解决Mysql报错:This function has none of DETERMINISTIC, NO SQL, or READS SQL DATA in its de_第1张图片

3.创建时添加红色的文字部分

解决Mysql报错:This function has none of DETERMINISTIC, NO SQL, or READS SQL DATA in its de_第2张图片

你可能感兴趣的:(#,Mysql,mysql,navicat,sql)