啟用二進制日誌 (log_bin) 時,創建函數/觸發器若未聲明 DETERMINISTIC、NO SQL 或 READS SQL DATA,會拋出錯誤:
ERROR 1418: This function has none of DETERMINISTIC, NO SQL, or READS SQL DATA
in its declaration and binary logging is enabled...
開啟(允許創建不安全函數):
SET GLOBAL log_bin_trust_function_creators = 1;
關閉(恢復嚴格模式):
SET GLOBAL log_bin_trust_function_creators = 0;
查看當前狀態:
SHOW VARIABLES LIKE '%func%';
DETERMINISTIC),避免依賴全域鬆綁。my.cnf [mysqld] 區段。Windows: net stop mysql / net start mysql 或「服務」面板操作。
Linux: service mysqld stop/start/restart 或 systemctl 指令。