• mysql 5.7 创建函数报错,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_creat


    今天用命令创建函数,

    报错

    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)

    原因是:

    当二进制日志启用后,这个log_bin_trust_function_creators变量就会启用。它控制是否可以信任存储函数创建者,不会创建写入二进制日志引起不安全事件的存储函数。如果设置为0(默认值),用户不得创建或修改存储函数,除非它们具有除CREATE ROUTINE或ALTER ROUTINE特权之外的SUPER权限。 设置为0还强制使用DETERMINISTIC特性或READS SQL DATA或NO SQL特性声明函数的限制。 如果变量设置为1,MySQL不会对创建存储函数实施这些限制。 此变量也适用于触发器的创建

    所以需要加一条命令

    set global log_bin_trust_function_creators=TRUE;   -- 设置,
    delimiter ;;
    CREATE FUNCTION concatFeatureJson(v_status tinyint, v_column_json VARCHAR(25)) RETURNS varchar(255) 
    begin
       declare v_sql varchar(2000);
       SELECT  group_concat(concat('JSON_EXTRACT(',v_column_json,',',''.$',feature_short_from_name,'') ',feature_short_from_name))  
         into v_sql from feature_space where status = v_status  ;
         
         RETURN v_sql;
    end
    ;;
    delimiter ;
  • 相关阅读:
    实现字符串的翻转
    svn的安装和配置
    insert php code test
    收集的一些题
    制作多选框,并通过PHP获取多选框数据
    laravel 导出
    laravel migrate 指定文件执行
    laravel facebook等第三方授权登录
    Mysql 时间字段(加上或者减去一段时间)
    配置指定日志记录目录
  • 原文地址:https://www.cnblogs.com/yancun8141/p/11325943.html
Copyright © 2020-2023  润新知