This function has none of DETERMINISTIC, NO SQL解決辦法
建立存儲過程時mysql
出錯信息:sql
ERROR 1418 (HY000): This function has none of DETERMINISTIC, NOSQL, or READS SQL DATA in its declaration and binary logging isenabled (you *might* want to use the less safelog_bin_trust_function_creators variable)less
緣由:ide
這是咱們開啓了bin-log, 咱們就必須指定咱們的函數是不是
1 DETERMINISTIC 不肯定的
2 NO SQL 沒有SQl語句,固然也不會修改數據
3 READS SQL DATA 只是讀取數據,固然也不會修改數據
4 MODIFIES SQL DATA 要修改數據
5 CONTAINS SQL 包含了SQL語句
其中在function裏面,只有 DETERMINISTIC, NO SQL 和 READS SQL DATA 被支持。若是咱們開啓了bin-log, 咱們就必須爲咱們的function指定一個參數。
函數
解決方法:spa
SQL code
mysql
>
showvariables
like
'log_bin_trust_function_creators';
+
--
-------------------------------+-------+
|
Variable_name
|
Value
|
+
--
-------------------------------+-------+
|
log_bin_trust_function_creators
|
OFF
|
+
--
-------------------------------+-------+
mysql
>
set
globallog_bin_trust_function_creators
=
1
;
mysql
>
showvariables
like
'
log_bin_trust_function_creators
'
;
+
--
-------------------------------+-------+
|
Variable_name
|
Value
|
+
--
-------------------------------+-------+
|
log_bin_trust_function_creators
|
ON
|
+
--
-------------------------------+-------+
這樣添加了參數之後,若是mysqld重啓,那個參數又會消失,所以記得在my.cnf配置文件中添加:log_bin_trust_function_creators=1