MySQL函數使用


 1、mysql開啟函數功能

MySQL函數不能創建的解決方法

在使用MySQL數據庫時,有時會遇到mysql函數不能創建的情況。

出錯信息大致類似:

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函數不能創建,是沒有開啟函數功能,下面操作開啟函數功能:

mysql> show variables like '%func%';
+---------------------------------+-------+
| Variable_name | Value |
+---------------------------------+-------+
| log_bin_trust_function_creators | OFF |
+---------------------------------+-------+
1 row in set (0.03 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.01 sec)

 

 2、grant 操作 MySQL 存儲過程、函數權限

grant create routine on dianshang_db.* to jenknins@'%';

grant alter routine on dianshang_db.* to jenkins@'%';

grant execute on dianshang_db.* to jenkins@'%';

 

參照文檔

https://blog.csdn.net/fanhenghui/article/details/69945846

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM