雖然很多朋友是在創建mysql函數時提示ERROR 1418錯誤,但我今天是在導入sql時也提示了ERROR 1418,這個是因為導入的sql中就有創建函數的一些語句了,其實與創建沒什么區別.
在將sql導入到mysql時候出現以下錯誤:
ERROR 1418 (HY000) at line 8752: 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官方文檔:http://dev.mysql.com/doc/refman/5.0/en/stored-programs-logging.html
必須設置,代碼如下:
global log_bin_trust_function_creatorssystem variable to 1.
mysql> SET GLOBAL log_bin_trust_function_creators = 1;
在my.ini(linux下為my.conf)文件中 [mysqld] 標記后加一行內容為 log-bin-trust-function-creators,
如果在create function的時候有 1418的錯語的時候:那么只需要執行set gl在創建子程序(存儲過程、函數、觸發器)時,聲明為DETERMINISTIC或NO SQL與READS SQL DATA中的一個,例如,代碼如下:
- CREATE DEFINER = CURRENT_USER PROCEDURE `NewProc`()
- DETERMINISTIC
- BEGIN
- #Routine body goes here...
- END; //開源軟件:Vevb.com
- obal log_bin_trust_routine_creators=1;
新聞熱點
疑難解答