MySQL創(chuàng)建函數(shù)報ERROR 1418錯誤,不能創(chuàng)建函數(shù),根據(jù)官方提示是說,不能創(chuàng)建函數(shù)可能是一個安全設(shè)置方面的配置或功能未開啟原因,下面我們一起來看.
錯誤: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函數(shù)不能創(chuàng)建,是未開啟功能.
根據(jù)系統(tǒng)提示,導(dǎo)致該錯誤的原因可能是一個安全設(shè)置方面的配置,查手冊log_bin_trust_function_creators參數(shù)缺省0,是不允許function的同步的,一般我們在配置repliaction的時候,都忘記關(guān)注這個參數(shù),這樣在master更新funtion后,slave就會報告錯誤,然后slave stoped.
處理過程:解決方法,MySQL函數(shù)不能創(chuàng)建,是未開啟功能,代碼如下:
- 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) //Vevb.com
- 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;
第二步:系統(tǒng)啟動時 –log-bin-trust-function-creators=1
第三步:在my.ini(Linux下為my.conf)文件中 [mysqld] 標(biāo)記后加一行內(nèi)容為 log-bin-trust-function-creators=1
新聞熱點
疑難解答
圖片精選