关注于系统高可用、网站架构
分类: Mysql/postgreSQL
2010-06-05 18:40:16
某一日,发现DB复制有问题
Last_Errno: 1418
Last_Error: Error '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)' on query. Default database: 'elearning_project_sxgzjs'. Query: 'CREATE ` FUNCTION rand_string(n INT)
RETURNS VARCHAR(255)
BEGIN
DECLARE chars_str varchar(100) DEFAULT '23456789abcdefghijkmnpqrstuvwxy';
DECLARE return_str varchar(255) DEFAULT '';
DECLARE i INT DEFAULT 0;
WHILE i < n DO
SET return_str = concat(return_str,substring(chars_str , FLOOR(RAND()*31 ),1));
SET i = i +1;
END WHILE;
RETURN return_str;
END'
mysql> SET GLOBAL log_bin_trust_function_creators = 1;