Help us understand the problem. What is going on with this article?

MySQLでFunctionを作成するために気を付けること

自分でやっていた際に起こったこと。

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

あースッキリ。

Why do not you register as a user and use Qiita more conveniently?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away