log_bin_trust_function_creators和max_allowed_packet
2014-03-07 11:24
281 查看
log_bin_trust_function_creators
This function has none of DETERMINISTIC, NO SQL解决办法
创建存储过程时
出错信息:
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_function_creators variable)
原因:
这是我们开启了bin-log, 我们就必须指定我们的函数是否是
1 DETERMINISTIC 不确定的
2 NO SQL 没有SQl语句,当然也不会修改数据
3 READS SQL DATA 只是读取数据,当然也不会修改数据
4 MODIFIES SQL DATA 要修改数据
5 CONTAINS SQL 包含了SQL语句
其中在function里面,只有 DETERMINISTIC, NO SQL 和 READS SQL DATA 被支持。如果我们开启了 bin-log, 我们就必须为我们的function指定一个参数。
解决方法:
SQL code
mysql>show variables
like
'log_bin_trust_function_creators';
+---------------------------------+-------+
|
Variable_name |
Value |
+---------------------------------+-------+
|
log_bin_trust_function_creators
| OFF
|
+---------------------------------+-------+
mysql>set
global log_bin_trust_function_creators=1;
mysql>show variables
like
'log_bin_trust_function_creators';
+---------------------------------+-------+
|
Variable_name |
Value |
+---------------------------------+-------+
|
log_bin_trust_function_creators
| ON
|
+---------------------------------+-------+
这样添加了参数以后,如果mysqld重启,那个参数又会消失,因此记得在my.cnf配置文件中添加:
log_bin_trust_function_creators=1
max_allowed_packet导致主从失败
This function has none of DETERMINISTIC, NO SQL解决办法
创建存储过程时
出错信息:
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_function_creators variable)
原因:
这是我们开启了bin-log, 我们就必须指定我们的函数是否是
1 DETERMINISTIC 不确定的
2 NO SQL 没有SQl语句,当然也不会修改数据
3 READS SQL DATA 只是读取数据,当然也不会修改数据
4 MODIFIES SQL DATA 要修改数据
5 CONTAINS SQL 包含了SQL语句
其中在function里面,只有 DETERMINISTIC, NO SQL 和 READS SQL DATA 被支持。如果我们开启了 bin-log, 我们就必须为我们的function指定一个参数。
解决方法:
SQL code
mysql>show variables
like
'log_bin_trust_function_creators';
+---------------------------------+-------+
|
Variable_name |
Value |
+---------------------------------+-------+
|
log_bin_trust_function_creators
| OFF
|
+---------------------------------+-------+
mysql>set
global log_bin_trust_function_creators=1;
mysql>show variables
like
'log_bin_trust_function_creators';
+---------------------------------+-------+
|
Variable_name |
Value |
+---------------------------------+-------+
|
log_bin_trust_function_creators
| ON
|
+---------------------------------+-------+
这样添加了参数以后,如果mysqld重启,那个参数又会消失,因此记得在my.cnf配置文件中添加:
log_bin_trust_function_creators=1
max_allowed_packet导致主从失败
131118 13:31:23 [ERROR] Error reading packet from server: log event entry exceeded max_allowed_packet; Increase max_allowed_packet on master ( server_errno=1236) 131118 13:31:23 [ERROR] Slave I/O: Got fatal error 1236 from master when reading data from binary log: 'log event entry exceeded max_allowed_packet; Increase max_allowed_packet on master', Error_code: 1236
解释:读取master binlog是由于单行记录超过了max_allowed_packet的限制大小。读取失败 原因: 事务具有四大特性:原子性,一致性,隔离性,持久性 max_allowed_packet 针对的是一个事务中的一行记录大小,当一行记录超过了限制的大小,将会报错。master上能插入成功的原因在于事务是不可分割的整体,他有原子性。不管多大,都会插入,然而 slave会通过dmp命令读取master的binlog,然后写入relay log中,当读取的一行记录大小超过max_allowed_packet的大小,将会报错。 解决方法: 加大max_allowed_packet大小即可;
搭建主/etc/my.cnf从务必加上:
[mysqld]
lower_case_table_names=1 log_bin_trust_function_creators=1 max_allowed_packet = 1516M
相关文章推荐
- log_bin_trust_function_creators & max_allowed_packet
- log_bin_trust_function_creators错误!
- log_bin_trust_function_creators
- MySQL创建Function时报的1418错误代号解决办法 log_bin_trust_function_creators
- Amazon RDS MySQL数据库还原时 log_bin_trust_function_creators 错误解决办法
- mysql----------mysql5.7.11导入sql文件的时候报错log_bin_trust_function_creators
- 函数相关参数 log_bin_trust_function_creators
- mysql 创建函数set global log_bin_trust_function_creators=TRUE;
- mysql 创建函数set global log_bin_trust_function_creators=TRUE;
- MySql DETERMINISTIC log_bin_trust_function_creators 自定义函数执行时报错
- mysql 创建函数set global log_bin_trust_function_creators=TRUE;
- SQL创建函数不成功的问题-log_bin_trust_function_creators参数研究
- log_bin_trust_function_creators变量解释
- MySQL参数log_bin_trust_function_creators介绍
- mysql 关于log_bin_trust_function_creators变量
- 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 event entry exceeded max_allowed_packet
- log_bin_trust_function_creators变量解释
- you *might* want to use the less safe log_bin_trust_function_creators variable
- log_bin_trust_function_creators错误解决