[轉]MySql建立函數問題

來源:互聯網
上載者:User

From : http://www.uini.net/2010/03/mysql-create-function-problem.html

    http://blog.csdn.net/wuhuiran/archive/2007/12/14/1935220.aspx

今天在整理資料時,又碰到MySQL函數不能建立的問題,以前也遇到過多次,解決是解決了,但是解決辦法總是記不住,也沒有很好地寫下來,以至於每次都要再次Google,耗時耗力,這次終於受不了了,還是選擇寫出來:

出錯資訊大致類似:

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> 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)

我們也可以在my.ini檔案中的mysqld中加入下面這一句

[mysqld]
log-bin=C:\Program Files\MySQL\MySQL Server 5.1\log\log-bin.log  --產生記錄檔
log-bin-trust-function-creators=1                    --function功能開啟

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.