本文實例講述了mysql設(shè)置觸發(fā)器權(quán)限的方法,針對權(quán)限錯誤的情況非常實用。具體分析如下:
mysql導(dǎo)入數(shù)據(jù)提示沒有super privilege權(quán)限處理,如下所示:
1 error 1419 (hy000): you do not have the super privilege and binary logging is enabled
導(dǎo)入function 、 trigger 到 mysql database,報錯:
1 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修改數(shù)據(jù)庫,錯誤只在啟用binary logging選項進(jìn)行主從復(fù)制的服務(wù)器上出現(xiàn)。
解決方法如下:
1)導(dǎo)入數(shù)據(jù)的用戶不僅需要create routine, alter routine, create trigger, alter trigger, create function 和 alter function 權(quán)限,還需要super privileges 權(quán)限,使用超級用戶導(dǎo)入數(shù)據(jù)。
2)讓所有用戶具有執(zhí)行類似functions的權(quán)限,危險,不推薦,
123 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)如果不需要復(fù)制,或者是從庫,關(guān)閉binlog,
1234 # binary logging – not required for slaves, but recommended #log-bin=mysql-bin # binary logging format – mixed recommended #binlog_format=mixed
希望本文所述對大家的mysql數(shù)據(jù)庫設(shè)計有所幫助。
更多信息請查看IT技術(shù)專欄