某一日,发现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 DEFINER=`root`@`localhost` 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执行下面的语句解决问题: mysql> SET GLOBAL log_bin_trust_function_creators = 1;