4

mysql ワークベンチのバックアップをインポートするには、mysql のスキーマ全体に対する TRIGGER 権限をユーザーに付与する必要があります。

私が試した:

grant trigger ON `schemaname`.* TO `user`@`localhost`

しかし、インポート中に、ユーザーに権限がないというエラーが発生します。

ERROR 1142 (42000) at line 53: TRIGGER command denied to user 'user'@'localhost' for table 'table'

ユーザーにテーブルへの TRIGGER アクセス許可を付与しようとしましたが、これは機能しますが、もちろんそのテーブルに対してのみであり、他のテーブルに対してはまだエラーが発生しています。

すべてのテーブルに対する権限を個別に付与せずに、ユーザーにスキーマへのトリガー権限を付与する方法はありますか?

4

2 に答える 2

3

MySQL ドキュメントから

In MySQL 5.0 CREATE TRIGGER requires the SUPER privilege.

そのため、ユーザーに SUPER 権限を付与する必要があります。インポート中に、エラーをスローしている「Create Trigger...」のようなコマンドがあります。

インポート ファイルのトリガーについて、MySQL のバージョンと定義者の値を確認します。

編集: バージョン 5.1 の場合は、MySQL のドキュメントに従ってください。

CREATE TRIGGER requires the TRIGGER privilege for the table associated with the 
trigger. The statement might also require the SUPER privilege, depending on 
the DEFINER value, as described later in this section. If binary logging is 
enabled, CREATE TRIGGER might require the SUPER privilege, as described in 
Section 19.7, “Binary Logging of Stored Programs”. (Before MySQL 5.1.6, there is 
no TRIGGER privilege and this statement requires the SUPER privilege in all cases)

The DEFINER clause determines the security context to be used when checking access
privileges at trigger activation time.

そのため、トリガーをインポートするための定義者の値を確認する必要があります。のようなものがあるかもしれません: DEFINER = root. 定義者を削除してから、インポートしてみてください。それがうまくいくことを願っています...

于 2012-08-02T12:54:40.690 に答える
0

MySQL のドキュメント:

To relax the preceding conditions on function creation (that you must have the
SUPER privilege and that a function must be declared deterministic or to not
modify data), set the global log_bin_trust_function_creators system variable
to 1. By default, this variable has a value of 0, but you can change it like
this:

mysql> SET GLOBAL log_bin_trust_function_creators = 1;
You can also set this variable by using the
--log-bin-trust-function-creators=1 
option when starting the server.

グローバル変数を設定し、トリガーを挿入できたセッションを再開しました

于 2016-11-04T11:44:15.267 に答える