錯誤
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)
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函數不能建立,是未開啟功能。
根據系統提示,導致該錯誤的原因可能是一個安全設定方面的配置,查手冊log_bin_trust_function_creators參數預設0,是不允許function的同步的,一般我們在配置repliaction的時候,都忘記關注這個參數,這樣在master更新funtion後,slave就會報告錯誤,然後slave stoped。
處理過程:
解決方案:MySQL函數不能建立,是未開啟功能:
| 代碼如下 |
複製代碼 |
mysql> show variables like ‘%func%’; +———————————+——-+ | Variable_name | Value | +———————————+——-+ | log_bin_trust_function_creators | OFF | +———————————+——-+ 1 row in set (0.00 sec) mysql> set global log_bin_trust_function_creators=1; Query OK, 0 rows affected (0.00 sec) mysql> show variables like ‘%func%’; +———————————+——-+ | Variable_name | Value | +———————————+——-+ | log_bin_trust_function_creators | ON | +———————————+——-+ 1 row in set (0.00 sec)mysql> |
如果上方法不能成功解決mysql中的ERROR 1418錯誤,那還得請你使用下面方法試試:
第一步: mysql> SET GLOBAL log_bin_trust_function_creators = 1;
第二步: 系統啟動時 –log-bin-trust-function-creators=1
第三步: 在my.ini(Linux下為my.conf)檔案中 [mysqld] 標記後加一行內容為 log-bin-trust-function-creators=1