最近在往mysql中导入数据时,提示错误

[root@test  mysql]# mysql -u root -p testdb< /tmp/test.sql
Enter password:
ERROR 1418 (HY000) at line 505500: 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> set global log_bin_trust_function_creators=1;
Query OK, 0 rows affected (0.00 sec)
修改my.cnf添加
log_bin_trust_function_creators=1;

使用set命令,不需要重启数据库就可以解决问题。
但是如果修改my.cnf文件,需要重启数据后才能生效。