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 ...
随机推荐
- vim的漫漫长征路
在系统的学习vim之前,先在网上找了些教程大概了解下,因为首先我们要先将vim给用起来,然后在系统的学习过程中不断的充实自己对vim的理解. ----------------------------- ...
- 引用 U-boot给kernel传参数和kernel读取参数—struct tag
引用 清风徐徐 的 U-boot给kernel传参数和kernel读取参数—struct tag U-boot会给Linux Kernel传递很多参数,如:串口,RAM,videofb等.而Linux ...
- eclipse 找不到application选项
处理如下:Window-Preferences-Run/Debug-Perspectives 中的 And Build修改为如下
- 15个最受欢迎的Python开源框架
以下是伯乐在线从GitHub中整理出的15个最受欢迎的Python开源框架.这些框架包括事件I/O,OLAP,Web开发,高性能网络通信,测试,爬虫等. Django: Python Web应用开发框 ...
- 如何A掉未来程序改
话说有这样一道神题:[集训队互测2015]未来程序·改. 大意是要求写一个简单的C++解释器!这里去掉了C++的许多特性,连简单的break和continue都没有了! 话说NOI被屠了之后,一时心血 ...
- Foundation补充
1常用结构体: NSRange.NSPoint(CGPoint).NSSize(CGSize).NSRect(CGRect) 2 NSRange: 字符串中有一个方法rangeOfString:str ...
- 演练2-4:CodeFirst实例之“电影网站制作”
原文出处:http://www.asp.net/mvc/tutorials/mvc-4/getting-started-with-aspnet-mvc4/adding-a-model EntityFr ...
- C#版二维码生成器附皮肤下载
原文 C#版二维码生成器附皮肤下载 前言 本文所使用的二维码生成代码是谷歌开源的条形码图像处理库完成的,c#版的代码可去https://code.google.com/p/zxing/download ...
- spark论坛
http://spark.apache.org/ http://bbs.csdn.net/forums/spark http://spark.csdn.net/ http://tieba.baidu. ...
- STM32 + RT Thread OS 学习笔记[二]
串口通讯例程 通过上面的练习,对STM32项目开发有了一个直观印象,接下来尝试对串口RS232进行操作. 1. 目标需求: 开机打开串口1,侦听上位机(使用电脑串口测试软件)发送的信息,然后原样输 ...