本文執行個體講述了MYSQL設定觸發器權限的方法,針對權限錯誤的情況非常實用。具體分析如下:
mysql導入資料提示沒有SUPER Privilege權限處理,如下所示:
ERROR 1419 (HY000): You do not have the SUPER Privilege and Binary Logging is Enabled
導入function 、 trigger 到 MySQL database,報錯:
You do not have the SUPER privilege and binary logging is enabled (you *might* want to use the less safe log_bin_trust_function_creators variable)”.
原因:
function / trigger 中有dangerous statements修改資料庫,錯誤隻在啟用binary logging選項進行主從複制的伺服器上出現。
解決方法如下:
1)導入資料的使用者不僅需要CREATE ROUTINE, ALTER ROUTINE, CREATE TRIGGER, ALTER TRIGGER, CREATE FUNCTION 和 ALTER FUNCTION 權限,還需要SUPER privileges 權限,使用超級使用者導入資料。
2)讓所有使用者具有執行類似functions的權限,危險,不推薦,
o by specifying it on the server start, like: –log-bin-trust-function-creators=1
o by setting it to 1 through the SET GLOBAL statement, like:
mysql> SET GLOBAL log_bin_trust_function_creators = 1;
3)如果不需要複制,或者是從庫,關閉binlog,
?
1 # binary logging – not required for slaves, but recommended
2 #log-bin=mysql-bin
3 # binary logging format – mixed recommended
4 #binlog_format=mixed
本文轉自陳繼松 51CTO部落格,原文連結:http://blog.51cto.com/chenjisong/1742961,如需轉載請自行聯系原作者