ERROR 1418 (HY000) at line 639: 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)
原来是由于在主从复制的两台MySQL服务器中开启了二进制日志选项log-bin,slave会从master复制数据,而一些操做,好比function所得的结果在master和slave上可能不一样,因此存在潜在的安全隐患。所以,在默认状况下回阻止function的建立。mysql
mysql> show variables like 'log_bin_trust_function_creators';
+---------------------------------+-------+
| Variable_name | Value |
+---------------------------------+-------+
| log_bin_trust_function_creators | OFF |
+---------------------------------+-------+sql
mysql> set global log_bin_trust_function_creators=1;vim
或vim /etc/my.cnf
log_bin_trust_function_creators=1安全