ERROR 1418 (HY000) at line 639:this function have none of deterministic, NO SQL, or READS SQL DATA in its declaration and Binary logging is enabled (you
mightWant to use the less safe log_bin_trust_function_creators variable)
It turns out that the binary log option is turned on for two MySQL servers in the master-slave replication Log-bin,slave will replicate data from master, and some operations, such as function results, may be different on master and slave, so there is a potential security risk. Therefore, the creation of the function is blocked by default.
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;
or vim/etc/my.cnf
Log_bin_trust_function_creators=1
MySQL Error 1418