自分でやっていた際に起こったこと。
MySQLにFunctionを作成しようとしたところ、以下のエラーが発生した。
ERROR 1418: 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)
こんなエラーは見たことなかったので調べたところ、意外にも原因がすぐに分かった。
SUPERまたはCREATE ROUTINE(ALTER ROUTINE)権限を持つ必要があるらしいのだが、「log_bin_trust_function_creators」を有効にすることでFunctionを登録できるようになるらしい。
有効にするやり方は以下。
mysql>SET GLOBAL log_bin_trust_function_creators = 1;
ちなみにmy.infに記述をしておくと起動時にlog_bin_trust_function_creatorsが有効になる。
vi /etc/my.cnf log_bin_trust_function_creators=1
あースッキリ。