mysql 创建函数set global log_bin_trust_function_creators=TRUE;
<pre name="code" class="html">set global log_bin_trust_function_creators=TRUE;
delimiter $$
CREATE DEFINER=`zjzc_app`@`%` FUNCTION `loadTreeByParent`(begin_sn INT) RETURNS varchar(600) CHARSET utf8
BEGIN
DECLARE rest VARCHAR(600);
DECLARE temp VARCHAR(60);
SET rest='$';
SET temp=CAST(begin_sn AS CHAR);
WHILE temp IS NOT NULL DO
SET rest=CONCAT(rest,',',temp);
SELECT GROUP_CONCAT(sn) INTO temp FROM ClientManager WHERE FIND_IN_SET(parent,temp)>0;
END WHILE;
RETURN rest;
END$$ This variable applies when binary logging is enabled.
It controls whether stored function creators can be trusted not to create stored functions
that will cause unsafe events to be written to the binary log.
If set to 0 (the default), users are not permitted to create or alter stored functions unless
they have the SUPER privilege in addition to the CREATE ROUTINE or ALTER ROUTINE privilege. A setting of 0 also enforces the restriction
that a function must be declared with the DETERMINISTIC characteristic, or with the READS SQL DATA or NO SQL characteristic.
If the variable is set to 1, MySQL does not enforce these restrictions on stored function creation. This variable also applies to trigger creation.
See Section 20.7, “Binary Logging of Stored Programs”. 这个变量应用当binary logging 被启用,它控制是否存储函数创建者可以被信任不是 创建函数 会影响不安全的事件被写入到binary log. 如果设置为0 默认情况下, 用户不允许创建或者修改存储过程除非它们有SUPER 权限 除了CREATE ROUTINE or ALTER ROUTINE 的权限。 设置为0也强制限制一个函数必须被定义DETERMINISTIC字符,或者 READS SQL DATA or NO SQL characteristic. 如果变量设置为1 MySQL 不强制那些限制在存储函数创建,这个变量也适用于触发器创建 [root@zjzc01 ~]# cat t1.sql
set global log_bin_trust_function_creators=TRUE;
delimiter $$
CREATE DEFINER=`zjzc_app`@`%` FUNCTION `loadTreeByParent`(begin_sn INT) RETURNS varchar(600) CHARSET utf8
BEGIN
DECLARE rest VARCHAR(600);
DECLARE temp VARCHAR(60);
SET rest='$';
SET temp=CAST(begin_sn AS CHAR);
WHILE temp IS NOT NULL DO
SET rest=CONCAT(rest,',',temp);
SELECT GROUP_CONCAT(sn) INTO temp FROM ClientManager WHERE FIND_IN_SET(parent,temp)>0;
END WHILE;
RETURN rest;
END$$ mysql> show create FUNCTION loadTreeByParent; mysql> use zjzc;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A Database changed
mysql> source t1.sql
Query OK, 0 rows affected (0.00 sec) Query OK, 0 rows affected, 1 warning (0.01 sec) mysql> quit | loadTreeByParent | STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION | CREATE DEFINER=`zjzc_app`@`%` FUNCTION `loadTreeByParent`(begin_sn INT) RETURNS varchar(600) CHARSET utf8
BEGIN
DECLARE rest VARCHAR(600);
DECLARE temp VARCHAR(60);
SET rest='$';
SET temp=CAST(begin_sn AS CHAR);
WHILE temp IS NOT NULL DO
SET rest=CONCAT(rest,',',temp);
SELECT GROUP_CONCAT(sn) INTO temp FROM ClientManager WHERE FIND_IN_SET(parent,temp)>0;
END WHILE;
RETURN rest; 默认OFF: mysql> show variables like '%log_bin_trust_function_creators%';
+---------------------------------+-------+
| Variable_name | Value |
+---------------------------------+-------+
| log_bin_trust_function_creators | OFF |
+---------------------------------+-------+
1 row in set (0.00 sec) my.cnf 文件添加: log_bin_trust_function_creators=1 owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql> show variables like '%log_bin_trust_function_creators%';
+---------------------------------+-------+
| Variable_name | Value |
+---------------------------------+-------+
| log_bin_trust_function_creators | ON |
+---------------------------------+-------+
1 row in set (0.01 sec)
mysql 创建函数set global log_bin_trust_function_creators=TRUE;的更多相关文章
- MySql创建函数与过程,触发器, shell脚本与sql的相互调用。
一:函数 1:创建数据库和表deptartment, mysql> use DBSC; Database changed mysql), ), )); Query OK, rows affect ...
- mysql创建函数槽点
上机环境 mysql8.0 navicat for mysql 很有那么一批软件程序,要不做点脱了裤子放屁的事儿就觉得自己不够二进制似的,今儿写了一下午mysql函数,怎么都通过不了,上网一看 mys ...
- Mysql创建函数出错
目前在项目中,执行创建mysql的函数出错, mysql 创建函数出错信息如下: Error Code: 1227. Access denied; you need (at least one of) ...
- MySQL创建函数报“ERROR 1418 ”错误,不能创建函数
MySQL创建函数报ERROR 1418错误,不能创建函数,根据官方提示是说,不能创建函数可能是一个安全设置方面的配置或功能未开启原因,下面我们一起来看. 错误 ERROR 1418 (HY000 ...
- MySQL 创建函数失败提示1418
MySQL 创建函数失败提示1418 在创建函数时,往往会遇到创建函数失败的情形,除去书写的创建函数的sql语句本身语法错误之外,还会碰到一个错误就是, 1418:This function has ...
- 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_f
mysql 创建函数的时候 报错 ERROR 1418 (HY000): This function has none of DETERMINISTIC, NO SQL, or READS SQL D ...
- MySQL 创建函数报错 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
问题描述 通过Navicat客户端,创建MySQL函数(根据的当前节点查询其左右叶子节点)时报错,报错信息如下: This function has none of DETERMINISTIC, NO ...
- mysql 创建函数This function has none of DETERMINISTIC, NO SQL, or READS
今天在mysql 5.6上创建函数的时候 发现报错: ERROR 1418 (HY000): This function has none of DETERMINISTIC, NO SQL, or R ...
- MySql 创建函数 Error Code : 1418
查看日志信息:show variables like 'log_%';显示'log_bin'.'log_bin_trust_function_creators'等状态 解决方法: 关闭binary l ...
随机推荐
- Observer设计模式【利用商品概念解释】
每个人都想过着富有的生活,这是很正常的. 这里以开店进货为例. 在讲之前解释英语单词: Observer:查看:遵守 Observable:可见的,公开的. 从单词可以知道:商品用来卖,所以公开,继承 ...
- 高级UIKit-09(TCPSocket发送文件、上传和下载)
[day1101_SocketSendFile]:发送文件到服务端 发送文件需要在该文件上拼接消息头,比如类型,文件名,文件大小 // 服务端 - (void)viewDidLoad { [super ...
- Orleans-Hello World
Orleans-Hello World http://www.rm5u.com/orleans/orleans-intro.html 什么是Orleans? Orleans(奥尔良) ...
- 【译】在Asp.Net中操作PDF – iTextSharp - 操作图片
原文 [译]在Asp.Net中操作PDF – iTextSharp - 操作图片 作为我的iTextSharp系列的文章的第七篇,开始探索使用iTextSharp在PDF中操作图片,理解本篇文章需要看 ...
- JVM调优总结(十二)-参考资料
能整理出上面一些东西,也是因为站在巨人的肩上.下面是一些参考资料,供大家学习,大家有更好的,可以继续完善:) · Java 理论与实践: 垃圾收集简史 · Java SE 6 HotSpot[tm] ...
- cmake手册详解----转
参考链接:http://www.cnblogs.com/coderfenghc/tag/cmake/
- 【代码】Android: 怎样设置app不被系统k掉
有一种方法可以设置app永远不会被kill,AndroidManifest.xml 中添加: android:persistent="true" 适用于放在/system/app下 ...
- 每天4个linux命令--步骤一
1 :Linux的诞生 Linux由芬兰赫尔辛基大学的Linus Torvalds创建 1991年10月,Linux第一个公开版 0.02版发布 1994年3月,Linux 1.0版发布 Linus ...
- 用 PS 复制权限
用 PS 复制权限 我们要把源计算机上的文件权限复制到目的计算机上. get-acl .\s.txt | Export-Clixml sddl.xml 把 s.txt 文件的权限保存到 sddl.xm ...
- GoldenGate配置(二)之双向复制配置
GoldenGate配置(二)之双向复制配置 环境: Item Source System Target System Platform Red Hat Enterprise Linux Serve ...