MySQL数据库中创建函数报“ERROR 1418 ”错误,不能创建函数的解决方法

我们在使用MySQL数据库开发项目的时候,有时MySQL系统自带的函数不能完全满足我们开发的需要,解决方法是自己创建函数,可以有可能在你创建函数的过程事会报出Error 1418错误

对于报这种错误的详细信息如所所示

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函数不能创建,是未开启功能:

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


» 本文链接:https://blog.apires.cn/archives/1253.html
» 转载请注明来源:Java地带  » 《MySQL数据库中创建函数报“ERROR 1418 ”错误,不能创建函数的解决方法》

» 本文章为Java地带整理创作,欢迎转载!转载请注明本文地址,谢谢!
» 部分内容收集整理自网络,如有侵权请联系我删除!

» 订阅本站:https://blog.apires.cn/feed/

标签: MySQL

添加新评论