mysql在自定义函数时会出现
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'end' at line 1
的错误,并且已经更改了标识符,通过百度发现是log_bin_trust_function_creators 属性没有开启
解决方法是:
一、
输入 show variables like '%func%'; 命令
会看到 log_bin_trust_function_creators 的状态,OFF表示自定义函数功能是关闭的
输入命令 set global log_bin_trust_function_creators=1;
再次输入show variables like '%func%'; 命令
这时log_bin_trust_function_creators 则为ON
二、
但是一方案,会因mysql自动重启后状态又会变为OFF,所以需要在
在服务启动时加上 “--log-bin-trust-function-creators=1 ”参数。
或在my.ini(my.cnf)中的[mysqld]区段中加上 log-bin-trust-function-creators=1。