代碼如下:
錯誤碼: 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正常運行,問題解決。