mysqlのfunctionを作成時のエラー[ERROR 1418 (HY000)]
mysqlのストアドファンクションを作成時に下記のエラーがでた。
/opt/db/mysql/bin/mysql -u root -h 127.0.0.1 -p < CREATE_GET_SITE_ID.sql
ERROR 1418 (HY000) at line 4: 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)
■ 「log_bin_trust_function_creators」を有効にすることで回避
ストアドファンクションの作成はSUPERまたはCREATE ROUTINE(ALTER ROUTINE)権限を持つ必要があるようだが、 「log_bin_trust_function_creators」を有効にすることで
mysql>SET GLOBAL log_bin_trust_function_creators = 1;
起動時に「 log_bin_trust_function_creators」を有効にするには、my.cnfに記述する。
# vi /etc/my.cnf log_bin_trust_function_creators=1
Mysqlのおすすめ書籍
エキスパートのためのMySQL[運用+管理]トラブルシューティングガイド |