MySQL建立函數報“ERROR 1418 ”錯誤,不能建立函數

來源:互聯網
上載者:User

錯誤

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函數不能建立,是未開啟功能。

根據系統提示,導致該錯誤的原因可能是一個安全設定方面的配置,查手冊log_bin_trust_function_creators參數預設0,是不允許function的同步的,一般我們在配置repliaction的時候,都忘記關注這個參數,這樣在master更新funtion後,slave就會報告錯誤,然後slave stoped。
處理過程:

解決方案:MySQL函數不能建立,是未開啟功能:

 代碼如下 複製代碼

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

如果上方法不能成功解決mysql中的ERROR 1418錯誤,那還得請你使用下面方法試試:

第一步: mysql> SET GLOBAL log_bin_trust_function_creators = 1;

第二步: 系統啟動時 –log-bin-trust-function-creators=1

第三步: 在my.ini(Linux下為my.conf)檔案中 [mysqld] 標記後加一行內容為 log-bin-trust-function-creators=1

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.