萬盛學電腦網

 萬盛學電腦網 >> 數據庫 >> mysql教程 >> MySQL創建函數出現1418錯誤解決辦法總結

MySQL創建函數出現1418錯誤解決辦法總結

本文章來給大家介紹關於MySQL創建函數出現1418錯誤解決方法,出現這種問題我們只要簡單的一句就可以解決了。


代碼如下:

錯誤碼: 1418
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) 這個是創建函數功能未開。

(you *might* want to use the less safe log_bin_trust_function_creators variable)
(0 ms taken)

分析:

根據系統提示,導致該錯誤的原因可能是一個安全設置方面的配置,查手冊

log_bin_trust_function_creators參數缺省0,是不允許function的同步的,一般我們在配置repliaction的時候,都忘記關注這個參數,這樣在master更新funtion後,slave就會報告錯誤,然後slave stoped。


處理過程:

登陸mysql數據庫

> set global log_bin_trust_function_creators = 1;
> start slave;

mysql> set og_bin_trust_function_creators =1;
ERROR 1193 (HY000): Unknown system variable 'og_bin_trust_function_creators'
mysql> set log_bin_trust_function_creators =1;
ERROR 1229 (HY000): Variable 'log_bin_trust_function_creators' is a GLOBAL variable and should be set with SET GLOBAL
mysql> set global log_bin_trust_function_creators =1;
Query OK, 0 rows affected (0.00 sec)

mysql> show variable like '%func%';
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'variable like '%func%'' at line 1
mysql> show variables like '%func%';
+---------------------------------+-------+
| Variable_name                   | Value |
+---------------------------------+-------+
| log_bin_trust_function_creators | ON    |
+---------------------------------+-------+
1 row in set (0.01 sec)

mysql> commit;
Query OK, 0 rows affected (0.00 sec)

mysql>

 

跟蹤mysql的啟動日志,slave正常運行,問題解決。

copyright © 萬盛學電腦網 all rights reserved