mysql 数据库创建function 的时候提示error 1418

本人菜鸟, 学习mysql数据库的时候 , 创建一个简单的function ,如下:


DELIMITER //
create function add_num( a int  , b int  )  returns int 
begin 
	declare tot int ;
    set tot = a + b ;
    return tot ;
end//
DELIMITER ;

然后就提示错误 :

ERROR code 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)

查了许多度娘,然后就明白了  log_bin_trust_function_creators 的限制效果。  

解决方法:

(1)首先查看 log_bin_trust_function_creators 的状态 , 看到是OFF ,要改为ON !

 show variables like 'log_bin_trust_function_creators'  ;

(2) 修改状态

SET @@global.log_bin_trust_function_creators='ON'  ;

(3)重新执行function代码 ,就可以了!!

相关推荐

  1. vs提示warning导致error问题

    2024-03-15 04:14:02       38 阅读
  2. MySQL数据库创建指令

    2024-03-15 04:14:02       36 阅读
  3. MySQL数据库——5、创建数据表

    2024-03-15 04:14:02       9 阅读

最近更新

  1. TCP协议是安全的吗?

    2024-03-15 04:14:02       18 阅读
  2. 阿里云服务器执行yum,一直下载docker-ce-stable失败

    2024-03-15 04:14:02       19 阅读
  3. 【Python教程】压缩PDF文件大小

    2024-03-15 04:14:02       18 阅读
  4. 通过文章id递归查询所有评论(xml)

    2024-03-15 04:14:02       20 阅读

热门阅读

  1. 电子信息工程实践案例分析报告

    2024-03-15 04:14:02       21 阅读
  2. PHP伪协议详解

    2024-03-15 04:14:02       23 阅读
  3. LeetCode(力扣)算法题_2864_最大二进制奇数

    2024-03-15 04:14:02       21 阅读
  4. 2.Linux文件IO基础

    2024-03-15 04:14:02       22 阅读
  5. 查看Linux服务器配置

    2024-03-15 04:14:02       23 阅读
  6. leetcode:反转链表II 和k个一组反转链表的C++实现

    2024-03-15 04:14:02       23 阅读
  7. 网络学习DAY3--TCP并发

    2024-03-15 04:14:02       21 阅读
  8. LeetCode2864. Maximum Odd Binary Number

    2024-03-15 04:14:02       28 阅读
  9. 动态规划 Leetcode 494 目标和

    2024-03-15 04:14:02       22 阅读
  10. 缓存穿透和缓存击穿有什么区别?

    2024-03-15 04:14:02       23 阅读
  11. jsonl文件介绍

    2024-03-15 04:14:02       22 阅读
  12. 封装数据请求方法与接口方法

    2024-03-15 04:14:02       25 阅读