MYSQL#1418错误

MYSQL#1418错误

原来的项目用的是原生的mysql数据库,需要测试数据的时候临时搭建了一个wamp的集成环境,将数据库文件导出之后再导入到wamp数据库中时报了#1418的错误,原因是在数据库中写了一个函数,但是没有声明他的确定性。

错误为

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)

解决方法有两种,一种是声明确定性,一种是修改mysql配置绕过检查

声明确定性

CREATE DEFINER = CURRENT_USER PROCEDURE `NewProc`()
    DETERMINISTIC
BEGIN
 #Routine body goes here...
END;

修改配置,在my.ini中的[mysqld]下加入

log-bin-trust-function-creators=1

猜你喜欢

转载自blog.csdn.net/wodecc_u/article/details/72896710
今日推荐