Home > Database > Mysql Tutorial > body text

mysql主从关于函数过程同步问题_MySQL

WBOY
Release: 2016-06-01 13:46:00
Original
1035 people have browsed it

bitsCN.com

发现mysql主从同上步 对于函数过程总是出错
 
MySQL创建函数问题分析:
根据系统提示,导致该错误的原因可能是一个安全设置方面的配置,查手册log_bin_trust_function_creators参数缺省0,是不 允许function的同步的。
一般我们在配置repliaction的时候,都忘记关注这个参数,这样在master更新funtion后,slave就会报告错误,然后slave stoped。
MySQL创建函数问题处理过程:
登陆mysql数据库
> set global log_bin_trust_function_creators = 1;
> start slave;
跟踪mysql的启动日志,slave正常运行,问题解决。
持续跟踪,经过一个晚上,bin-relay-log的数据全部同步完毕。 直接在my.cnf里面添加
log_bin_trust_function_creators = 1
 
 
========================================================================
创建function时
出错信息:
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 '%func%';
+---------------------------------+-------+
|Variable_name |Value|
+---------------------------------+-------+
|log_bin_trust_function_creators|OFF |
+---------------------------------+-------+
1 row in set (0.00sec)
mysql>set global log_bin_trust_function_creators=1;
Query OK,0 rows affected (0.00sec)
mysql>show variables like '%func%';
+---------------------------------+-------+
|Variable_name |Value|
+---------------------------------+-------+
|log_bin_trust_function_creators|ON |
+---------------------------------+-------+
1 row in set (0.00sec)
mysql>
 
 
试过了,这个方法很有效的。

bitsCN.com
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!