博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
mysql 创建函数set global log_bin_trust_function_creators=TRUE;
阅读量:4943 次
发布时间:2019-06-11

本文共 3542 字,大约阅读时间需要 11 分钟。

set global log_bin_trust_function_creators=TRUE;delimiter $$ CREATE DEFINER=`zjzc_app`@`%` FUNCTION `loadTreeByParent`(begin_sn INT) RETURNS varchar(600) CHARSET utf8BEGIN 	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 utf8BEGIN 	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 namesYou can turn off this feature to get a quicker startup with -ADatabase changedmysql> source t1.sqlQuery 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 utf8BEGIN 	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=1owners.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)
 

转载于:https://www.cnblogs.com/zhaoyangjian724/p/6199923.html

你可能感兴趣的文章
项目练习计划
查看>>
Xshell远程登录
查看>>
@RequestParam与@PathVariable的区别
查看>>
C语言之break和continue
查看>>
jquery.form.js使用
查看>>
LINQ to Entities 不支持 LINQ 表达式节点类型“ArrayIndex”。
查看>>
回顾2012,展望2013
查看>>
Spring中的ApplicationContextAware使用
查看>>
HDU-2067-小兔的棋盘
查看>>
监听手机录音
查看>>
hadoop的WordCount样例
查看>>
客户化程序完成标准成本成批更新
查看>>
JZOJ 1286. 太空电梯
查看>>
大数据平台组件布置 与 进程查看
查看>>
Hadoop3集群搭建之——hive添加自定义函数UDTF (一行输入,多行输出)
查看>>
【转】去除inline-block元素的间隙
查看>>
JS - Math对象
查看>>
MUI开发指南(二) webview对象
查看>>
HTML5按键打开摄像头和拍照
查看>>
基本sql语句--触发器
查看>>