Mysql:开启了log-bin的MySQL Server中创建FUNCTION
2018-01-13 14:48
495 查看
1.错误信息
在开启了bin-log模式的Mysql服务中,创建Function失败。Error Code: 1418. 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)
2.原因分析
在主从复制的两台MySQL服务器中开启了二进制日志选项log-bin,slave会从master复制数据,而一些操作,比如function所得的结果在master和slave上可能不同,所以存在潜在的安全隐患。因此,在默认情况下Mysql会阻止function的创建。3.解决问题
这里提供两种方式:3.1. mysql> set global log_bin_trust_function_creators=1;
在mysql服务中执行set global log_bin_trust_function_creators=1;
这种方式只是在当前Mysql运行期间有效,Mysql服务重启失效。
3.2. > vim /etc/my.cnf
在my.cnf(或my.ini)中添加配置项log-bin-trust-function-creators
> service mysqld stop > vim /etc/my.cnf [mysqld] log-bin-trust-function-creators = 1 > Service mysqld start
相关文章推荐
- 如何在开启了log-bin的MySQL Server中创建FUNCTION
- 如何在开启了log-bin的MySQL Server中创建FUNCTION
- mysql 创建函数set global log_bin_trust_function_creators=TRUE;
- mysql 创建函数set global log_bin_trust_function_creators=TRUE;
- mysql 创建函数set global log_bin_trust_function_creators=TRUE;
- MySQL 开启bin-log,创建函数出错。DETERMINISTIC
- Windows下MySQL开启log-bin
- MySql DETERMINISTIC log_bin_trust_function_creators 自定义函数执行时报错
- [MySQL] you *might* want to use the less safe log_bin_trust_function_creators variable
- mysql异地容灾备份开启log_bin
- 开启bin-log日志mysql报错的解决方法
- MySQL参数log_bin_trust_function_creators介绍
- mysql----------mysql5.7.11导入sql文件的时候报错log_bin_trust_function_creators
- Ubuntu下开启mysql的bin_log日志
- Windows Mysql Server重启, log-bin路径配置
- windows下Mysql如何开启log_bin?
- Windows下Mysql 5.7.19 开启bin-log以及mysql配置
- mysql的一大坑——细说mysql 开启log_bin日志以用于恢复数据库
- mysql 关于log_bin_trust_function_creators变量
- mysql的log-bin设置开启失败的原因