mysql 报错之创建自定义函数
I experienced this error while trying to alter one of my stored procedures remotely on a master server. After some research, I ended up getting information from “Binary Logging of Stored Programs“.
From MySQL Reference in verbatim:
When you create a stored function, you must declare either that it is deterministic or that it does not modify data. Otherwise, it may be unsafe for data recovery or replication.
By default, for a CREATE FUNCTION statement to be accepted, at least one of DETERMINISTIC, NO SQL, or READS SQL DATA must be specified explicitly. Otherwise an error occurs:
Further reading helped me arrive to the conclusion to the cause of this error:
The error arises if the binary logging option, which is required for the replication, is turned on for the MySQL server.
We can choose solutions listed below depending to our system requirements, for me, I opted on using the later.
- When creating or altering a stored function, you must declare either that it is deterministic or that it does not modify data. Otherwise, it may be unsafe for data recovery or replication.
- To relax the preceding conditions on function creation (that you must have the SUPER privilege and that a function must be declared deterministic or to not modify data), set the global log_bin_trust_function_creators system variable to 1. By default, this variable has a value of 0, but you can change it like this:
mysql> SET GLOBAL log_bin_trust_function_creators = 1;
You can also set this variable by using the –log-bin-trust-function-creators=1 option when starting the server.
MySQL Open Source Software Development
POSTED ON SUNDAY, NOVEMBER 11TH, 2012 AT 11:54 PM PRINT THIS ARTICLE EMAIL THIS ARTICLE
ob·liv·i·on
Reference : Merriam-Webster
- the fact or condition of forgetting or having forgotten; especially : the condition of being oblivious
- the condition or state of being forgotten or unknown
tH3 oBlivIOus
Aldwin Llacuna Galapon
IT Consultant / Software and Web Developer
Do not take life too seriously. You might not get out of it alive!
mysql 报错之创建自定义函数的更多相关文章
- mysql创建自定义函数与存储过程
mysql创建自定义函数与存储过程 一 创建自定义函数 在使用mysql的过程中,mysql自带的函数可能不能完成我们的业务需求,这时就需要自定义函数,例如笔者在开发过程中遇到下面这个问题 mysql ...
- MySQL 创建自定义函数(2)
说明:下面创建一个函数,调用自定义函数返回一个返回一个随机数. (1) 创建自定义函数
- 开启bin-log日志mysql报错:This function has none of DETERMINISTIC, NO SQL解决办法
开启bin-log日志mysql报错:This function has none of DETERMINISTIC, NO SQL解决办法: 创建存储过程时 出错信息: ERROR 1418 (HY ...
- 安装mysql报错
原文链接:https://blog.csdn.net/bao19901210/article/details/51917641 二进制安装 1.添加mysql组和mysql用户,用于设置mysql安装 ...
- PHP连接MySQL报错:SQLSTATE[HY000] [2002] Can't connect to local MySQL server through socket 'MySQL' (2)
如下所示,PHP连接MySQL报错: SQLSTATE[HY000] [2002] Can't connect to local MySQL server through socket 'MySQL' ...
- 【mysql的编程专题⑤】自定义函数
用户自定义函数(user-defined function,UDF) 是一种对mysql的扩展途径,其用法与内置函数相同 创建自定义函数 语法 create function function_nam ...
- 解决:MySQL 报错:1045 - Access denied for user 'root'@'localhost'(using password YES)
一.前言 今年疯狂迷上了开源,只要看到好的开源项目,就会不顾一切一股脑扎进去研究,五一期间发现一个很好的关于众筹的开源项目,但不巧,这个项目竟然是 PHP 写的,没学过 PHP,自然对这个开源项目毫无 ...
- MySQL报错ERROR 1558 (HY000): Column count of mysql.user is wrong.
MySQL报错ERROR 1558 (HY000): Column count of mysql.user is wrong. 1.今天在使用MySQL创建数据库时出现如下报错: mysql> ...
- Mysql报错java.sql.SQLException:null,message from server:"Host '27,45,38,132' is not allowed to connect
Mysql报错java.sql.SQLException:null,message from server:"Host '27,45,38,132' is not allowed to co ...
随机推荐
- 浏览器HTML5支持程度测试
/********************************************************************* * 浏览器HTML5支持程度测试 * 说明: * 想知道对 ...
- Scrum&Kanban在移动开发团队的实践 (一)
现在大多数团队都在谈敏捷开发,似乎觉得敏捷是软件开发的银弹.只需要实践下一些敏捷开发的模式就能如何如何,其实我觉得不论是敏捷开发还是传统的瀑布流开发都是有他们的市场的,取决于团队人员构成,取决你的产品 ...
- Oracle Analyze 命令 详解
官网的链接如下: http://docs.oracle.com/cd/E11882_01/server.112/e26088/statements_4005.htm#SQLRF01105 使用DBMS ...
- Java基础——I/O续
目录 二进制I/O类 文件导航和I/O 二进制I/O类 FileInputStream类和FileOutputStream类 *FileOutputStream(file: File) *FileOu ...
- android中sqlite3常用命令
1)打开数据库 在adb shell模式下执行命令sqlite3 + 数据库名称,例如打开email中的EmailProvider.db数据库: 2)sqlite3特殊命令 大多数候,sqlite3读 ...
- HTTP协议学习笔记-2
HTTP报文 HTTP报文分为请求报文和响应报文(requeset and response) 请求报文的格式: <method> <request -URL> <ve ...
- 《Python 学习手册4th》 第十三章 while和for循环
''' 时间: 9月5日 - 9月30日 要求: 1. 书本内容总结归纳,整理在博客园笔记上传 2. 完成所有课后习题 注:“#” 后加的是备注内容 (每天看42页内容,可以保证月底看完此书) “重点 ...
- 详解Asp.net MVC DropDownLists
Asp.net MVC中的DropDownLists貌似会让一开始从Asp.net Forms转过来的程序员造成不少迷惑.这篇文章讲述了为了使用DropDownLists,你需要在Asp.Net MV ...
- 通过SQL进行远程访问
通过SQL语句访问远程数据库 1.得建立链接服务器: --删除链接服务器 if exists(select * from master.dbo.sysservers where isremote=0 ...
- schema对象介绍
1.schema对象简介 数据库schema为一组数据结构的逻辑集合,称之为schema对象,schema对象最贱的为表和索引,schema对象由SQL创建和维护. 一个数据库用户拥有一个用户名和各种 ...