mysql----------mysql5.7.11导入sql文件时报错This function has none of DETERMINISTIC, NO SQL, or READS SQL DATA in its declaration and binary logging is enabled

时间:2023-03-09 04:54:37
mysql----------mysql5.7.11导入sql文件时报错This function has none of DETERMINISTIC, NO SQL, or READS SQL DATA in its declaration and binary logging is enabled

1、导入sql文件出现如下错误。

mysql----------mysql5.7.11导入sql文件时报错This function has none of DETERMINISTIC, NO SQL, or READS SQL DATA in its declaration and binary logging is enabled

[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)
[Err] SET FOREIGN_KEY_CHECKS=0;

解决方案:

log_bin_trust_routine_creators全局系统变量为1。设置方法有三种:
  1.在客户端上执行SET GLOBAL log_bin_trust_function_creators = 1;
  2.MySQL启动时,加上--log-bin-trust-function-creators选贤,参数设置为1
  3.在MySQL配置文件my.ini或my.cnf中的[mysqld]段上加log-bin-trust-function-creators=1